use of org.springframework.core.serializer.support.SerializingConverter in project spring-framework by spring-projects.
the class SerializationConverterTests method nonSerializableField.
@Test
public void nonSerializableField() {
SerializingConverter toBytes = new SerializingConverter();
try {
toBytes.convert(new UnSerializable());
fail("Expected SerializationFailureException");
} catch (SerializationFailedException e) {
assertNotNull(e.getCause());
assertTrue(e.getCause() instanceof NotSerializableException);
}
}
use of org.springframework.core.serializer.support.SerializingConverter in project spring-framework by spring-projects.
the class SerializationConverterTests method nonSerializableObject.
@Test
public void nonSerializableObject() {
SerializingConverter toBytes = new SerializingConverter();
try {
toBytes.convert(new Object());
fail("Expected IllegalArgumentException");
} catch (SerializationFailedException e) {
assertNotNull(e.getCause());
assertTrue(e.getCause() instanceof IllegalArgumentException);
}
}
use of org.springframework.core.serializer.support.SerializingConverter in project spring-framework by spring-projects.
the class SerializationConverterTests method serializeAndDeserializeString.
@Test
public void serializeAndDeserializeString() {
SerializingConverter toBytes = new SerializingConverter();
byte[] bytes = toBytes.convert("Testing");
DeserializingConverter fromBytes = new DeserializingConverter();
assertEquals("Testing", fromBytes.convert(bytes));
}
Aggregations