### Question:
PriceServiceImpl implements PriceService { @Override public Response findAllPriceConfig(HttpHeaders headers) { List<PriceConfig> list = priceConfigRepository.findAll(); if (list == null) { list = new ArrayList<>(); } if (!list.isEmpty()) { return new Response<>(1, "Success", list); } else { return new Response<>(0, "No price config", null); } }  @Override Response createNewPriceConfig(PriceConfig createAndModifyPriceConfig, HttpHeaders headers); @Override PriceConfig findById(String id, HttpHeaders headers); @Override Response findByRouteIdAndTrainType(String routeId, String trainType, HttpHeaders headers); @Override Response findAllPriceConfig(HttpHeaders headers); @Override Response deletePriceConfig(PriceConfig c, HttpHeaders headers); @Override Response updatePriceConfig(PriceConfig c, HttpHeaders headers);  }### Answer:
@Test public void testFindAllPriceConfig1() { Mockito.when(priceConfigRepository.findAll()).thenReturn(null); Response result = priceServiceImpl.findAllPriceConfig(headers); Assert.assertEquals(new Response<>(0, "No price config", null), result); }
@Test public void testFindAllPriceConfig2() { List<PriceConfig> list = new ArrayList<>(); list.add(new PriceConfig()); Mockito.when(priceConfigRepository.findAll()).thenReturn(list); Response result = priceServiceImpl.findAllPriceConfig(headers); Assert.assertEquals(new Response<>(1, "Success", list), result); }