### Question:
ConsignServiceImpl implements ConsignService { @Override public Response queryByConsignee(String consignee, HttpHeaders headers) { List<ConsignRecord> consignRecords = repository.findByConsignee(consignee); if (consignRecords != null && !consignRecords.isEmpty()) { return new Response<>(1, "Find consign by consignee success", consignRecords); }else { return new Response<>(0, "No Content according to consignee", 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 testQueryByConsignee1() { ArrayList<ConsignRecord> consignRecords = new ArrayList<>(); consignRecords.add(new ConsignRecord()); Mockito.when(repository.findByConsignee(Mockito.anyString())).thenReturn(consignRecords); Response result = consignServiceImpl.queryByConsignee("consignee", headers); Assert.assertEquals(new Response<>(1, "Find consign by consignee success", consignRecords), result); }
@Test public void testQueryByConsignee2() { Mockito.when(repository.findByConsignee(Mockito.anyString())).thenReturn(null); Response result = consignServiceImpl.queryByConsignee("consignee", headers); Assert.assertEquals(new Response<>(0, "No Content according to consignee", null), result); }