Exemple #1
0
 @Test
 public void testJsonSerializationObjectVersionOld() throws Exception {
   VersionedObject obj = new VersionedObject();
   obj.setDepricatedInt32Field(241901);
   assertEquals(
       obj,
       versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V1_0, "json"));
 }
Exemple #2
0
 @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"));
 }
Exemple #3
0
  @Test
  public void testJsonSerializationObjectVersionNew() throws Exception {
    VersionedObject obj = new VersionedObject();
    obj.setNewInt64Field(242341223412L);

    assertEquals(
        obj,
        versioningRoundTripSerailization(obj, Serializer.VERSION_VERSIONING_TEST_V2_0, "json"));
  }
Exemple #4
0
  @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"));
  }
Exemple #5
0
  @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());
  }
Exemple #6
0
  @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());
  }
Exemple #7
0
  @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");
  }
Exemple #8
0
  @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");
  }