### Question:
PriceServiceImpl implements PriceService { @Override public Response createNewPriceConfig(PriceConfig createAndModifyPriceConfig, HttpHeaders headers) { PriceServiceImpl.LOGGER.info("[Price Service][Create New Price Config]"); PriceConfig priceConfig = null; if (createAndModifyPriceConfig.getId() == null || createAndModifyPriceConfig.getId().toString().length() < 10) { priceConfig = new PriceConfig(); priceConfig.setId(UUID.randomUUID()); priceConfig.setBasicPriceRate(createAndModifyPriceConfig.getBasicPriceRate()); priceConfig.setFirstClassPriceRate(createAndModifyPriceConfig.getFirstClassPriceRate()); priceConfig.setRouteId(createAndModifyPriceConfig.getRouteId()); priceConfig.setTrainType(createAndModifyPriceConfig.getTrainType()); priceConfigRepository.save(priceConfig); } else { priceConfig = priceConfigRepository.findById(createAndModifyPriceConfig.getId()); if (priceConfig == null) { priceConfig = new PriceConfig(); priceConfig.setId(createAndModifyPriceConfig.getId()); } priceConfig.setBasicPriceRate(createAndModifyPriceConfig.getBasicPriceRate()); priceConfig.setFirstClassPriceRate(createAndModifyPriceConfig.getFirstClassPriceRate()); priceConfig.setRouteId(createAndModifyPriceConfig.getRouteId()); priceConfig.setTrainType(createAndModifyPriceConfig.getTrainType()); priceConfigRepository.save(priceConfig); } return new Response<>(1, "Create success", priceConfig); }  @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 testCreateNewPriceConfig1() { PriceConfig createAndModifyPriceConfig = new PriceConfig(); Mockito.when(priceConfigRepository.save(Mockito.any(PriceConfig.class))).thenReturn(null); Response result = priceServiceImpl.createNewPriceConfig(createAndModifyPriceConfig, headers); Assert.assertNotNull(result.getData()); }