### Question:
MultiplicationController { @GetMapping("/random") Multiplication getRandomMultiplication() { return multiplicationService.createRandomMultiplication(); } @Autowired  MultiplicationController(final MultiplicationService multiplicationService);   }### Answer:
@Test public void getRandomMultiplicationTest() throws Exception{ given(multiplicationService.createRandomMultiplication()) .willReturn(new Multiplication(70, 20)); MockHttpServletResponse response = mvc.perform( get("/multiplications/random") .accept(MediaType.APPLICATION_JSON)) .andReturn().getResponse(); assertThat(response.getStatus()).isEqualTo(HttpStatus.OK.value()); assertThat(response.getContentAsString()) .isEqualTo(json.write(new Multiplication(70, 20)).getJson()); }