@Test(expected = ValidationException.class) public void shouldCreateTheSettingsOnlyOnce() throws ValidationException { Settings settings = new Settings(); settingsDAO.create(settings); given(settingsRepository.count()).willReturn(1L); settingsDAO.create(settings); }
public void create(Settings settings) throws ValidationException { if (settingsRepository.count() == 1) { throw new ValidationException("The settings have already been created."); } settingsRepository.save(settings); updateDriverSystemProperties(settings.getDriverSettings()); }
SettingsDAO { public void create(Settings settings) throws ValidationException { if (settingsRepository.count() == 1) { throw new ValidationException("The settings have already been created."); } settingsRepository.save(settings); updateDriverSystemProperties(settings.getDriverSettings()); } }
SettingsDAO { public void create(Settings settings) throws ValidationException { if (settingsRepository.count() == 1) { throw new ValidationException("The settings have already been created."); } settingsRepository.save(settings); updateDriverSystemProperties(settings.getDriverSettings()); } @Autowired  SettingsDAO(SettingsRepository settingsRepository); }
SettingsDAO { public void create(Settings settings) throws ValidationException { if (settingsRepository.count() == 1) { throw new ValidationException("The settings have already been created."); } settingsRepository.save(settings); updateDriverSystemProperties(settings.getDriverSettings()); } @Autowired  SettingsDAO(SettingsRepository settingsRepository); void create(Settings settings); Settings get(); void update(Settings settings); void removeDriver(String driver); void uploadDriver(MultipartFile file, String driver); void updateDriver(InputStream is, String filename, String driver); void updateDriverSystemProperties(DriverSettings driverSettings); }
SettingsDAO { public void create(Settings settings) throws ValidationException { if (settingsRepository.count() == 1) { throw new ValidationException("The settings have already been created."); } settingsRepository.save(settings); updateDriverSystemProperties(settings.getDriverSettings()); } @Autowired  SettingsDAO(SettingsRepository settingsRepository); void create(Settings settings); Settings get(); void update(Settings settings); void removeDriver(String driver); void uploadDriver(MultipartFile file, String driver); void updateDriver(InputStream is, String filename, String driver); void updateDriverSystemProperties(DriverSettings driverSettings);  }