### Question:
ConsignServiceImpl implements ConsignService { @Override public Response insertConsignRecord(Consign consignRequest, HttpHeaders headers) { ConsignServiceImpl.LOGGER.info("[Consign servie] [ Insert new consign record] {}", consignRequest.getOrderId()); ConsignRecord consignRecord = new ConsignRecord(); consignRecord.setId(UUID.randomUUID()); LOGGER.info("Order ID is :" + consignRequest.getOrderId()); consignRecord.setOrderId(consignRequest.getOrderId()); consignRecord.setAccountId(consignRequest.getAccountId()); ConsignServiceImpl.LOGGER.info("The handle date is {}", consignRequest.getHandleDate()); ConsignServiceImpl.LOGGER.info("The target date is {}", consignRequest.getTargetDate()); consignRecord.setHandleDate(consignRequest.getHandleDate()); consignRecord.setTargetDate(consignRequest.getTargetDate()); consignRecord.setFrom(consignRequest.getFrom()); consignRecord.setTo(consignRequest.getTo()); consignRecord.setConsignee(consignRequest.getConsignee()); consignRecord.setPhone(consignRequest.getPhone()); consignRecord.setWeight(consignRequest.getWeight()); HttpEntity requestEntity = new HttpEntity(null, headers); ResponseEntity<Response<Double>> re = restTemplate.exchange( "http: HttpMethod.GET, requestEntity, new ParameterizedTypeReference<Response<Double>>() { }); consignRecord.setPrice(re.getBody().getData()); LOGGER.info("SAVE consign info : " + consignRecord.toString()); ConsignRecord result = repository.save(consignRecord); LOGGER.info("SAVE consign result : " + result.toString()); return new Response<>(1, "You have consigned successfully! The price is " + result.getPrice(), result); }  @Override Response insertConsignRecord(Consign consignRequest, HttpHeaders headers); @Override Response updateConsignRecord(Consign consignRequest, HttpHeaders headers); @Override Response queryByAccountId(UUID accountId, HttpHeaders headers); @Override Response queryByOrderId(UUID orderId, HttpHeaders headers); @Override Response queryByConsignee(String consignee, HttpHeaders headers);  }### Answer:
@Test public void testInsertConsignRecord() { HttpEntity requestEntity = new HttpEntity(null, headers); Response<Double> response = new Response<>(1, null, 3.0); ResponseEntity<Response<Double>> re = new ResponseEntity<>(response, HttpStatus.OK); Consign consignRequest = new Consign(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, true); ConsignRecord consignRecord = new ConsignRecord(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), "handle_date", "target_date", "place_from", "place_to", "consignee", "10001", 1.0, 3.0); Mockito.when(restTemplate.exchange( "http: HttpMethod.GET, requestEntity, new ParameterizedTypeReference<Response<Double>>() { })).thenReturn(re); Mockito.when(repository.save(Mockito.any(ConsignRecord.class))).thenReturn(consignRecord); Response result = consignServiceImpl.insertConsignRecord(consignRequest, headers); Assert.assertEquals(new Response<>(1, "You have consigned successfully! The price is 3.0", consignRecord), result); }