@Test
  public void testSerDePreElasticSystemStreamPartition() throws IOException {
    ObjectMapper preElasticObjectMapper = getPreEleasticObjectMapper();
    ObjectMapper elasticObjectMapper = SamzaObjectMapper.getObjectMapper();


    //Scenario 1: ssp serialized with preElasticMapper and deserialized by new Mapper with elasticity
    SystemStreamPartition ssp = new SystemStreamPartition("foo", "bar", new Partition(1));
    String serializedString = preElasticObjectMapper.writeValueAsString(ssp);

    ObjectMapper objectMapper = new ObjectMapper();
    ObjectNode serializedSSPAsJson = objectMapper.createObjectNode();
    serializedSSPAsJson.put("system", "foo");
    serializedSSPAsJson.put("stream", "bar");
    serializedSSPAsJson.put("partition", 1);

    JsonNode deserSSPAsJson = elasticObjectMapper.readTree(serializedString);

    assertEquals(serializedSSPAsJson.get("system"), deserSSPAsJson.get("system"));
    assertEquals(serializedSSPAsJson.get("stream"), deserSSPAsJson.get("stream"));
    assertEquals(serializedSSPAsJson.get("partition"), deserSSPAsJson.get("partition"));
    assertEquals(serializedSSPAsJson.get("keyBucket"), deserSSPAsJson.get("-1"));

    //Scenario 1: ssp serialized with new elasticMapper and deserialized by old preElastic Mapper
    SystemStreamPartition sspWithKeyBucket = new SystemStreamPartition("foo", "bar", new Partition(1), 1);
    serializedString = elasticObjectMapper.writeValueAsString(sspWithKeyBucket);


    serializedSSPAsJson = objectMapper.createObjectNode();
    serializedSSPAsJson.put("system", "foo");
    serializedSSPAsJson.put("stream", "bar");
    serializedSSPAsJson.put("partition", 1);
    serializedSSPAsJson.put("keyBucket", 1);

    deserSSPAsJson = preElasticObjectMapper.readTree(serializedString);

    assertEquals(serializedSSPAsJson.get("system"), deserSSPAsJson.get("system"));
    assertEquals(serializedSSPAsJson.get("stream"), deserSSPAsJson.get("stream"));
    assertEquals(serializedSSPAsJson.get("partition"), deserSSPAsJson.get("partition"));
  }
Given a {@link ContainerModel} JSON with only an "id" field, deserialization should fail.
This verifies that even though {@link ContainerModel} has a getId method, the "id" field is not used, since
"processor-id" is the field that is supposed to be used.
samza-core/src/test/java/org/apache/samza/serializers/model/TestSamzaObjectMapper.java