### Question:
ConsignServiceImpl implements ConsignService { @Override public Response queryByAccountId(UUID accountId, HttpHeaders headers) { List<ConsignRecord> consignRecords = repository.findByAccountId(accountId); if (consignRecords != null && !consignRecords.isEmpty()) { return new Response<>(1, "Find consign by account id success", consignRecords); }else { return new Response<>(0, "No Content according to accountId", 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 testQueryByAccountId1() { UUID accountId = UUID.randomUUID(); ArrayList<ConsignRecord> consignRecords = new ArrayList<>(); consignRecords.add(new ConsignRecord()); Mockito.when(repository.findByAccountId(Mockito.any(UUID.class))).thenReturn(consignRecords); Response result = consignServiceImpl.queryByAccountId(accountId, headers); Assert.assertEquals(new Response<>(1, "Find consign by account id success", consignRecords), result); }
@Test public void testQueryByAccountId2() { UUID accountId = UUID.randomUUID(); Mockito.when(repository.findByAccountId(Mockito.any(UUID.class))).thenReturn(null); Response result = consignServiceImpl.queryByAccountId(accountId, headers); Assert.assertEquals(new Response<>(0, "No Content according to accountId", null), result); }