@Test public void shouldSaveMaintenanceRequestForFacilityWithoutServiceContract() throws Exception { EquipmentInventory inventory = make(a(EquipmentInventoryBuilder.defaultEquipmentInventory)); inventory.setEquipmentId(3L); when(equipmentInventoryRepository.getInventoryById(1L)).thenReturn(inventory); when(serviceContractRepository.getAllForEquipment(3L)).thenReturn(null); MaintenanceRequest request = new MaintenanceRequest(); request.setInventoryId(1L); service.save(request); verify(repository).insert(any(MaintenanceLog.class)); }
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);  }