Package org.springframework.core.serializer.support

Examples of org.springframework.core.serializer.support.SerializingConverter.convert()


public class SerializationConverterTests {

  @Test
  public void serializeAndDeserializeString() {
    SerializingConverter toBytes = new SerializingConverter();
    byte[] bytes = toBytes.convert("Testing");
    DeserializingConverter fromBytes = new DeserializingConverter();
    assertEquals("Testing", fromBytes.convert(bytes));
  }

  @Test
View Full Code Here


  @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);
View Full Code Here

  @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);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.