### Question:
SecurityServiceImpl implements SecurityService { @Override public Response check(String accountId, HttpHeaders headers) { SecurityServiceImpl.LOGGER.info("[Security Service][Get Order Num Info]"); OrderSecurity orderResult = getSecurityOrderInfoFromOrder(new Date(), accountId, headers); OrderSecurity orderOtherResult = getSecurityOrderOtherInfoFromOrder(new Date(), accountId, headers); int orderInOneHour = orderOtherResult.getOrderNumInLastOneHour() + orderResult.getOrderNumInLastOneHour(); int totalValidOrder = orderOtherResult.getOrderNumOfValidOrder() + orderResult.getOrderNumOfValidOrder(); SecurityServiceImpl.LOGGER.info("[Security Service][Get Security Config Info]"); SecurityConfig configMaxInHour = securityRepository.findByName("max_order_1_hour"); SecurityConfig configMaxNotUse = securityRepository.findByName("max_order_not_use"); SecurityServiceImpl.LOGGER.info("[Security Service] Max In One Hour: {} Max Not Use: {}", configMaxInHour.getValue(), configMaxNotUse.getValue()); int oneHourLine = Integer.parseInt(configMaxInHour.getValue()); int totalValidLine = Integer.parseInt(configMaxNotUse.getValue()); if (orderInOneHour > oneHourLine || totalValidOrder > totalValidLine) { return new Response<>(0, "Too much order in last one hour or too much valid order", accountId); } else { return new Response<>(1, "Success.r", accountId); } }  @Override Response findAllSecurityConfig(HttpHeaders headers); @Override Response addNewSecurityConfig(SecurityConfig info, HttpHeaders headers); @Override Response modifySecurityConfig(SecurityConfig info, HttpHeaders headers); @Override Response deleteSecurityConfig(String id, HttpHeaders headers); @Override Response check(String accountId, HttpHeaders headers);  }### Answer:
@Test public void testCheck() { OrderSecurity orderSecurity = new OrderSecurity(1, 1); Response<OrderSecurity> response1 = new Response<>(null, null, orderSecurity); ResponseEntity<Response<OrderSecurity>> re1 = new ResponseEntity<>(response1, HttpStatus.OK); Mockito.when(restTemplate.exchange( Mockito.anyString(), Mockito.any(HttpMethod.class), Mockito.any(HttpEntity.class), Mockito.any(ParameterizedTypeReference.class))) .thenReturn(re1); SecurityConfig securityConfig = new SecurityConfig(); securityConfig.setValue("2"); Mockito.when(securityRepository.findByName(Mockito.anyString())).thenReturn(securityConfig); Response result = securityServiceImpl.check("account_id", headers); Assert.assertEquals(new Response<>(1, "Success.r", "account_id"), result); }