Java Code Examples for org.apache.commons.lang3.SerializationUtils#roundtrip()

The following examples show how to use org.apache.commons.lang3.SerializationUtils#roundtrip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementListenersTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test
public void serializable() {
    ns.add("click", noOp).addEventData("eventdata");

    ElementListenerMap roundtrip = SerializationUtils.roundtrip(ns);

    Set<String> expressions = roundtrip.getExpressions("click");
    Assert.assertEquals(Collections.singleton("eventdata"), expressions);
}
 
Example 2
Source File: AbstractCompositeFieldTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test
public void serializable() {
    ReverseCaseField field = new ReverseCaseField();
    field.addValueChangeListener(ignore -> {
    });
    field.setValue("foo");

    ReverseCaseField anotherField = SerializationUtils.roundtrip(field);
    Assert.assertEquals("foo", anotherField.getValue());
}
 
Example 3
Source File: AbstractFieldTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test
public void serializable() {
    TestAbstractField<String> field = new TestAbstractField<>();
    field.addValueChangeListener(ignore -> {
    });
    field.setValue("foo");

    TestAbstractField<String> anotherField = SerializationUtils
            .roundtrip(field);
    Assert.assertEquals("foo", anotherField.getValue());
}
 
Example 4
Source File: AbstractSinglePropertyFieldTest.java    From flow with Apache License 2.0 5 votes vote down vote up
@Test
public void serializable() {
    StringField field = new StringField();
    field.addValueChangeListener(ignore -> {
    });
    field.setValue("foo");

    StringField anotherField = SerializationUtils.roundtrip(field);
    Assert.assertEquals("foo", anotherField.getValue());
}
 
Example 5
Source File: SerializableMatchers.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
public static <T extends Serializable> Matcher<T> serializesRoundTrip(final Matcher<T> matcher) {
    return new FeatureMatcher<T, T>(matcher, "serializes round trip", "serializes round trip") {
        @Override
        protected T featureValueOf(final T actual) {
            return SerializationUtils.roundtrip(actual);
        }
    };
}
 
Example 6
Source File: ExponentialBackoffRetryHandlerTest.java    From data-highway with Apache License 2.0 4 votes vote down vote up
@Test
public void testSerializability() throws Exception  {
  ExponentialBackoffRetryHandler underTest = new ExponentialBackoffRetryHandler(3, Duration.ZERO, Duration.ZERO, sleeper);

  SerializationUtils.roundtrip(underTest);
}
 
Example 7
Source File: LocalizedMessageTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
private <T extends Serializable> T roundtrip(final T msg) {
    return SerializationUtils.roundtrip(msg);
}