ReceiverController { @RequestMapping("/{payloadType}/count") public ReceiveCount findReceiveCount(@PathVariable("payloadType") PayloadType payloadType) { return receiveCountService.findReceiveCount(payloadType); }  @RequestMapping(method = RequestMethod.POST, value = "/receive") void receivePayload(@RequestBody Payload payload); @RequestMapping("/{payloadType}/count") ReceiveCount findReceiveCount(@PathVariable("payloadType") PayloadType payloadType);  }
@Test public void testFindReceiveCount() throws Exception { ResultActions actions = mockMvc.perform( get("/" + PayloadType.TEST1 + "/count")); MvcResult result = actions.andExpect( status().isOk()) .andReturn(); String sendCountJson = result.getResponse().getContentAsString(); ReceiveCount sendCount = deserializeReceiveCount(sendCountJson); assertEquals(PayloadType.TEST1, sendCount.getPayloadType()); assertEquals(1, sendCount.getTimesReceived()); }