@Test public void shouldSaveReading() throws Exception { Long readingId = 3L; RefrigeratorReading refrigeratorReading = mock(RefrigeratorReading.class); RefrigeratorProblem refrigeratorProblem = mock(RefrigeratorProblem.class); when(refrigeratorReading.getProblem()).thenReturn(refrigeratorProblem); when(refrigeratorReading.getId()).thenReturn(readingId); repository.saveReading(refrigeratorReading); verify(mapper).insertReading(refrigeratorReading); verify(refrigeratorProblem).setReadingId(readingId); verify(mapper).insertProblem(refrigeratorReading.getProblem()); }
public void saveReading(RefrigeratorReading reading) { mapper.insertReading(reading); RefrigeratorProblem problem = reading.getProblem(); if (problem != null) { problem.setReadingId(reading.getId()); mapper.insertProblem(problem); } }
DistributionRefrigeratorsRepository { public void saveReading(RefrigeratorReading reading) { mapper.insertReading(reading); RefrigeratorProblem problem = reading.getProblem(); if (problem != null) { problem.setReadingId(reading.getId()); mapper.insertProblem(problem); } } }
DistributionRefrigeratorsRepository { public void saveReading(RefrigeratorReading reading) { mapper.insertReading(reading); RefrigeratorProblem problem = reading.getProblem(); if (problem != null) { problem.setReadingId(reading.getId()); mapper.insertProblem(problem); } }  }
DistributionRefrigeratorsRepository { public void saveReading(RefrigeratorReading reading) { mapper.insertReading(reading); RefrigeratorProblem problem = reading.getProblem(); if (problem != null) { problem.setReadingId(reading.getId()); mapper.insertProblem(problem); } }  void saveReading(RefrigeratorReading reading); DistributionRefrigerators getBy(Long facilityVisitId); }
DistributionRefrigeratorsRepository { public void saveReading(RefrigeratorReading reading) { mapper.insertReading(reading); RefrigeratorProblem problem = reading.getProblem(); if (problem != null) { problem.setReadingId(reading.getId()); mapper.insertProblem(problem); } }  void saveReading(RefrigeratorReading reading); DistributionRefrigerators getBy(Long facilityVisitId);  }