@Test
  public void testReadContainerLocality() throws Exception {
    URL url = new URL(webApp.getUrl().toString() + "locality");

    String response = HttpUtil.read(url, 1000, new ExponentialSleepStrategy());
    LocalityModel locality = mapper.readValue(response, LocalityModel.class);

    assertEquals("Expected locality for two containers", 2, locality.getProcessorLocalities().size());
    assertEquals("Mismatch in locality for processor " + PROCESSOR_ID1,
        locality.getProcessorLocality(PROCESSOR_ID1), PROCESSOR_1_LOCALITY);
    assertEquals("Mismatch in locality for processor " + PROCESSOR_ID2,
        locality.getProcessorLocality(PROCESSOR_ID2), PROCESSOR_2_LOCALITY);
  }
A test class for {@link LocalityServlet}. It validates the servlet directly and Serde Mix-In of {@link ProcessorLocality}
indirectly.
samza-yarn3/src/test/java/org/apache/samza/webapp/TestLocalityServlet.java