@Test
  public void testSerdeSystemStreamPartitionKey() throws IOException {

    // get object mapper which has old deserialization logic for SSP as Key
    ObjectMapper oldDeserForSSPObjectMapper = getOldDeserForSSpKeyObjectMapper();

    SystemStreamPartition ssp = new SystemStreamPartition("foo", "bar", new Partition(1));
    String offset = "100";

    String sspmapString = this.samzaObjectMapper.writeValueAsString(ImmutableMap.of(ssp, offset));

    TypeReference<HashMap<SystemStreamPartition, String>> typeRef
        = new TypeReference<HashMap<SystemStreamPartition, String>>() { };

    // case 1: deserialize with the new logic for SSP key deser
    Map<SystemStreamPartition, String> deserSSPMap = this.samzaObjectMapper.readValue(sspmapString, typeRef);
    SystemStreamPartition deserSSP = deserSSPMap.keySet().stream().findAny().get();
    String deserOffset = deserSSPMap.values().stream().findFirst().get();
    assertEquals(ssp.getSystem(), deserSSP.getSystem());
    assertEquals(ssp.getStream(), deserSSP.getStream());
    assertEquals(ssp.getPartition(), deserSSP.getPartition());
    assertEquals(ssp.getKeyBucket(), deserSSP.getKeyBucket());
    assertEquals(offset, deserOffset);

    // case 2: deserialize with the OLD logic for SSP key deser
    deserSSPMap = oldDeserForSSPObjectMapper.readValue(sspmapString, typeRef);
    deserSSP = deserSSPMap.keySet().stream().findAny().get();
    deserOffset = deserSSPMap.values().stream().findFirst().get();
    assertEquals(ssp.getSystem(), deserSSP.getSystem());
    assertEquals(ssp.getStream(), deserSSP.getStream());
    assertEquals(ssp.getPartition(), deserSSP.getPartition());
    assertEquals(ssp.getKeyBucket(), deserSSP.getKeyBucket());
    assertEquals(offset, deserOffset);
  }
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