This commit is contained in:
Dominic Fox 2019-02-26 18:22:32 +00:00 committed by Mike Hearn
parent 74c5b8d127
commit 2173228b27
2 changed files with 49 additions and 0 deletions

View File

@ -97,4 +97,53 @@ public class JavaEvolutionTests {
N2.class, N2.class,
TestSerializationContext.testSerializationContext); TestSerializationContext.testSerializationContext);
} }
// Class as it was when it was serialized and written to disk. Uncomment
// if the test referencing the object needs regenerating.
/*
@SuppressWarnings("unused")
static class POJOWithInteger {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
*/
public interface ForceEvolution { }
// Class as it exists now with the newly added element
@SuppressWarnings("unused")
static class POJOWithInteger implements ForceEvolution {
private Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
@Test
public void testNullableInteger() throws IOException {
// Uncomment to regenerate the base state of the test
//POJOWithInteger n = new POJOWithInteger();
//n.setId(100);
//AMQPTestUtilsKt.writeTestResource(this, new SerializationOutput(factory).serialize(
// n, TestSerializationContext.testSerializationContext));
POJOWithInteger n2 = new DeserializationInput(factory).deserialize(
new SerializedBytes<>(AMQPTestUtilsKt.readTestResource(this)),
POJOWithInteger.class,
TestSerializationContext.testSerializationContext);
assertEquals(Integer.valueOf(100), n2.getId());
}
} }