FibonacciRestEndpoint implements FibonacciEndpoint { @Override @RequestMapping(value = "/term", method = RequestMethod.GET) @ResponseBody public long term(int n) { return fibonacciService.term(n); } @Autowired  FibonacciRestEndpoint(FibonacciService fibonacciService); @Override @RequestMapping(value = "/term", method = RequestMethod.GET) @ResponseBody long term(int n);  }
@Test public void returnsTokenOfAuthenticatedUser() throws Exception { when(fibonacciService.term(term)).thenReturn(expected); mockMvc.perform( get("/fibonacci/term") .param("n", String.valueOf(term))) .andExpect(status().isOk()) .andExpect(content().string(String.valueOf(expected))); }