Polish JdkMongoSessionConverter

* Serializer/Deserializer -> Converter API
* Verify/Test null constructor arguments

Issue gh-431
This commit is contained in:
Rob Winch
2016-03-16 21:06:57 -05:00
parent 9014ac9060
commit b58ea03a3b
2 changed files with 34 additions and 40 deletions

View File

@@ -19,6 +19,8 @@ import com.mongodb.DBObject;
import org.junit.Test;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.core.serializer.support.DeserializingConverter;
import org.springframework.core.serializer.support.SerializingConverter;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextImpl;
import org.springframework.session.ExpiringSession;
@@ -28,11 +30,22 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Jakub Kubrynski
* @author Rob Winch
*/
public class JdkMongoSessionConverterTests {
JdkMongoSessionConverter sut = new JdkMongoSessionConverter();
@Test(expected = IllegalArgumentException.class)
public void constructorNullSerializer() {
new JdkMongoSessionConverter(null, new DeserializingConverter());
}
@Test(expected = IllegalArgumentException.class)
public void constructorNullDeserializer() {
new JdkMongoSessionConverter(new SerializingConverter(), null);
}
@Test
public void verifyRoundTripSerialization() throws Exception {
// given