@Test public void testJsonSerializationObjectVersionOld() throws Exception { VersionedObject obj = new VersionedObject(); obj.setDepricatedInt32Field(241901); assertEquals( obj, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V1_0, "json")); }
@Test public void testJsonSerializationEnumVersionOld() throws Exception { VersionedObject obj = new VersionedObject(); obj.setEnumField(VersionedEnum.Value3); assertEquals( obj, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V1_0, "json")); }
@Test public void testJsonSerializationObjectVersionNew() throws Exception { VersionedObject obj = new VersionedObject(); obj.setNewInt64Field(242341223412L); assertEquals( obj, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V2_0, "json")); }
@Test public void testBinarySerializationEnumVersionNew() throws Exception { VersionedObject obj = new VersionedObject(); obj.setEnumField(VersionedEnum.Value4); assertEquals( obj, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V2_0, "binary")); }
@Test public void testJsonSerializationObjectVersionUseNewValueInOldVersion() throws Exception { VersionedObject obj = new VersionedObject(); obj.setNewInt64Field(1L); assertEquals( null, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V1_0, "json") .getNewInt64Field()); }
@Test public void testBinarySerializationObjectVersionUseRemovedValue() throws Exception { VersionedObject obj = new VersionedObject(); obj.setDepricatedInt32Field(1); assertEquals( null, versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V2_0, "binary") .getDepricatedInt32Field()); }
@Test public void testJsonSerializationEnumVersionUseRemovedValue() throws Exception { thrown.expect(TeslaSerializationException.class); thrown.expectMessage("is not allowed"); VersionedObject obj = new VersionedObject(); obj.setEnumField(VersionedEnum.Value3); versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V2_0, "json"); }
@Test public void testBinarySerializationEnumVersionUseNewValueInOldVersion() throws Exception { thrown.expect(TeslaSerializationException.class); thrown.expectMessage("is not allowed"); VersionedObject obj = new VersionedObject(); obj.setEnumField(VersionedEnum.Value4); versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V1_0, "binary"); }