Ejemplo n.º 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"));
 }
Ejemplo n.º 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"));
 }
Ejemplo n.º 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"));
  }
Ejemplo n.º 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"));
  }
Ejemplo n.º 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());
  }
Ejemplo n.º 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());
  }
Ejemplo n.º 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");
  }
Ejemplo n.º 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");
  }