### Question:
FoodMapServiceImpl implements FoodMapService { @Override public TrainFood createTrainFood(TrainFood tf, HttpHeaders headers) { TrainFood tfTemp = trainFoodRepository.findById(tf.getId()); if (tfTemp != null) { FoodMapServiceImpl.LOGGER.info("[Food Map Service][Init TrainFood] Already Exists Id: {}", tf.getId()); } else { trainFoodRepository.save(tf); } return tf; }  @Override Response createFoodStore(FoodStore fs, HttpHeaders headers); @Override TrainFood createTrainFood(TrainFood tf, HttpHeaders headers); @Override Response listFoodStores(HttpHeaders headers); @Override Response listTrainFood(HttpHeaders headers); @Override Response listFoodStoresByStationId(String stationId, HttpHeaders headers); @Override Response listTrainFoodByTripId(String tripId, HttpHeaders headers); @Override Response getFoodStoresByStationIds(List<String> stationIds);  }### Answer:
@Test public void testCreateTrainFood1() { TrainFood tf = new TrainFood(); Mockito.when(trainFoodRepository.findById(Mockito.any(UUID.class))).thenReturn(tf); TrainFood result = foodMapServiceImpl.createTrainFood(tf, headers); Assert.assertEquals(tf, result); }
@Test public void testCreateTrainFood2() { TrainFood tf = new TrainFood(); Mockito.when(trainFoodRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Mockito.when(trainFoodRepository.save(Mockito.any(TrainFood.class))).thenReturn(null); TrainFood result = foodMapServiceImpl.createTrainFood(tf, headers); Assert.assertEquals(tf, result); }