@Test public void shouldDeleteReportingData() throws Exception { Map<String, Object> data = new HashMap<>(); ReportDataDeleteRequest dataRequest = new ReportDataDeleteRequest().withType("Boo").withDristhiEntityId("entity id 1"); data.put("data", dataRequest); when(agent.post(eq("http://drishti/delete"), any(String.class), eq("application/json"))) .thenReturn(new HttpResponse(true, null)); listener.deleteReportingData(new MotechEvent("SUBJECT", data)); verify(agent) .post( "http://drishti/delete", "{\"type\":\"Boo\",\"dristhiEntityId\":\"entity id 1\"}", "application/json"); }