Greeting g3 = buildGreeting(3L);
recordTemplates.put(new ComplexResourceKey<Greeting, Greeting>(g1, g1), g1);
recordTemplates.put(new ComplexResourceKey<Greeting, Greeting>(g2, g2), g2);
errorResponses.put(new ComplexResourceKey<Greeting, Greeting>(g3, g3), new ErrorResponse().setMessage("3"));
BatchKVResponse<ComplexResourceKey<Greeting, Greeting>, Greeting> response =
MockBatchKVResponseFactory.createWithComplexKey(Greeting.class,
Greeting.class,
Greeting.class,
recordTemplates,
errorResponses);
Map<ComplexResourceKey, Greeting> storedResults = new HashMap<ComplexResourceKey, Greeting>();
for (Map.Entry<ComplexResourceKey<Greeting, Greeting>, Greeting> entry: recordTemplates.entrySet())
{
storedResults.put(new ComplexResourceKey<Greeting, Greeting>(entry.getKey().getKey(),
new Greeting()), entry.getValue());
}
Map<ComplexResourceKey, ErrorResponse> storedErrorResponses = new HashMap<ComplexResourceKey, ErrorResponse>();
storedErrorResponses.put(new ComplexResourceKey<Greeting, Greeting>(g3, new Greeting()),
new ErrorResponse().setMessage("3"));
Assert.assertEquals(response.getResults(), storedResults);
Assert.assertEquals(response.getErrors(), storedErrorResponses);
}