use of com.izforge.izpack.api.installer.DataValidator in project robozonky by RoboZonky.
the class StrategySettingsValidatorTest method wrongData.
@Test
void wrongData() {
final DataValidator validator = new StrategySettingsValidator();
assertThat(validator.validateData(StrategySettingsValidatorTest.mockInstallData())).isEqualTo(DataValidator.Status.ERROR);
}
use of com.izforge.izpack.api.installer.DataValidator in project robozonky by RoboZonky.
the class StrategySettingsValidatorTest method urlNoContent.
@Test
void urlNoContent() throws IOException {
final File f = File.createTempFile("robozonky-", ".cfg");
final InstallData d = StrategySettingsValidatorTest.mockInstallData(f.toURI().toURL());
// execute sut
final DataValidator validator = new StrategySettingsValidator();
final DataValidator.Status result = validator.validateData(d);
// execute test
assertThat(result).isEqualTo(DataValidator.Status.WARNING);
}
use of com.izforge.izpack.api.installer.DataValidator in project robozonky by RoboZonky.
the class StrategySettingsValidatorTest method urlOk.
@Test
void urlOk() throws IOException {
final File f = File.createTempFile("robozonky-", ".cfg");
Files.write(f.toPath(), Collections.singleton("Content"), Defaults.CHARSET);
final InstallData d = StrategySettingsValidatorTest.mockInstallData(f.toURI().toURL());
// execute sut
final DataValidator validator = new StrategySettingsValidator();
final DataValidator.Status result = validator.validateData(d);
// execute test
assertThat(result).isEqualTo(DataValidator.Status.OK);
}
use of com.izforge.izpack.api.installer.DataValidator in project robozonky by RoboZonky.
the class ZonkoidSettingsValidatorTest method zonkoidProper.
@Test
void zonkoidProper() {
final ConfirmationProvider cp = mock(ConfirmationProvider.class);
when(cp.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(true);
final InstallData d = ZonkoidSettingsValidatorTest.mockInstallData();
// execute SUT
final DataValidator validator = new ZonkoidSettingsValidator(() -> Optional.of(cp));
final DataValidator.Status result = validator.validateData(d);
// run test
assertThat(result).isEqualTo(DataValidator.Status.OK);
}
use of com.izforge.izpack.api.installer.DataValidator in project robozonky by RoboZonky.
the class ZonkoidSettingsValidatorTest method zonkoidPresentButRejecting.
@Test
void zonkoidPresentButRejecting() {
final ConfirmationProvider cp = mock(ConfirmationProvider.class);
when(cp.requestConfirmation(any(), anyInt(), anyInt())).thenReturn(false);
final InstallData d = ZonkoidSettingsValidatorTest.mockInstallData();
// execute SUT
final DataValidator validator = new ZonkoidSettingsValidator(() -> Optional.of(cp));
final DataValidator.Status result = validator.validateData(d);
// run test
assertThat(result).isEqualTo(DataValidator.Status.WARNING);
}
Aggregations