@Test public void shouldInserOnNewSave() throws Exception { MaintenanceLog log = new MaintenanceLog(); log.setId(null); service.save(log); verify(repository).insert(log); verify(repository, never()).update(log); }
public void save(MaintenanceLog log) { if (log.getId() == null) { repository.insert(log); } else { repository.update(log); } }
MaintenanceLogService { public void save(MaintenanceLog log) { if (log.getId() == null) { repository.insert(log); } else { repository.update(log); } } }
MaintenanceLogService { public void save(MaintenanceLog log) { if (log.getId() == null) { repository.insert(log); } else { repository.update(log); } }  }
MaintenanceLogService { public void save(MaintenanceLog log) { if (log.getId() == null) { repository.insert(log); } else { repository.update(log); } }  List<MaintenanceLog> getAll(); List<MaintenanceLog> getAllForFacility(Long facilityId); List<MaintenanceLog> getAllForVendor(Long vendorId); MaintenanceLog getById(Long id); void save(MaintenanceLog log); void save(MaintenanceRequest maintenanceRequest); }
MaintenanceLogService { public void save(MaintenanceLog log) { if (log.getId() == null) { repository.insert(log); } else { repository.update(log); } }  List<MaintenanceLog> getAll(); List<MaintenanceLog> getAllForFacility(Long facilityId); List<MaintenanceLog> getAllForVendor(Long vendorId); MaintenanceLog getById(Long id); void save(MaintenanceLog log); void save(MaintenanceRequest maintenanceRequest);  }