### Question:
AddPlacesToPopulationHandler implements ContextualRequestMessageHandler<Population> { @Override public MessageBody handleRequest(Population context, PlatformMessage msg) { return doHandleRequest(context, msg); } @Inject  AddPlacesToPopulationHandler(PopulationDAO populationDao, PlaceDAO placeDao, PlatformMessageBus platformBus); @Override String getMessageType(); @Override MessageBody handleRequest(Population context, PlatformMessage msg); @Override MessageBody handleStaticRequest(PlatformMessage msg);  }### Answer:
@Test public void testAddPlacesSuccess2() throws Exception { setupMocksForSuccess(false); replay(); PlatformMessage request = request(createMessageBody(null, place1, place2)); MessageBody response = handler.handleRequest(population, request); assertEquals(MessageBody.emptyMessage(), response); assertEquals(population.getName(), place1.getPopulation()); assertEquals(population.getName(), place2.getPopulation()); verify(); }
@Test public void testAddPlacesPopulationContextDoesNotMatch() throws Exception { PlatformMessage request = request(createMessageBody(population, place1, place2)); Population population2 = Fixtures.createPopulation(); try{ handler.handleRequest(population2, request); }catch(ErrorEventException e) { assertEquals(Errors.CODE_INVALID_PARAM, e.getCode()); } }