### Question:
ConsignServiceImpl implements ConsignService { @Override public Response queryByOrderId(UUID orderId, HttpHeaders headers) { ConsignRecord consignRecords = repository.findByOrderId(orderId); if (consignRecords != null ) { return new Response<>(1, "Find consign by order id success", consignRecords); }else { return new Response<>(0, "No Content according to order id", null); } }  @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 testQueryByOrderId1() { UUID orderId = UUID.randomUUID(); ConsignRecord consignRecords = new ConsignRecord(); Mockito.when(repository.findByOrderId(Mockito.any(UUID.class))).thenReturn(consignRecords); Response result = consignServiceImpl.queryByOrderId(orderId, headers); Assert.assertEquals(new Response<>(1, "Find consign by order id success", consignRecords), result); }
@Test public void testQueryByOrderId2() { UUID orderId = UUID.randomUUID(); Mockito.when(repository.findByOrderId(Mockito.any(UUID.class))).thenReturn(null); Response result = consignServiceImpl.queryByOrderId(orderId, headers); Assert.assertEquals(new Response<>(0, "No Content according to order id", null), result); }