Package org.springframework.core.serializer.support

Examples of org.springframework.core.serializer.support.SerializingConverter


*/
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));
  }
View Full Code Here


    assertEquals("Testing", fromBytes.convert(bytes));
  }

  @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

Related Classes of org.springframework.core.serializer.support.SerializingConverter

Copyright © 2018 www.massapicom. 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.