Search in sources :

Example 1 with DataValidator

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);
}
Also used : DataValidator(com.izforge.izpack.api.installer.DataValidator) Test(org.junit.jupiter.api.Test)

Example 2 with DataValidator

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);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with DataValidator

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);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 4 with DataValidator

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);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) ConfirmationProvider(com.github.robozonky.api.confirmations.ConfirmationProvider) Test(org.junit.jupiter.api.Test)

Example 5 with DataValidator

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);
}
Also used : InstallData(com.izforge.izpack.api.data.InstallData) DataValidator(com.izforge.izpack.api.installer.DataValidator) ConfirmationProvider(com.github.robozonky.api.confirmations.ConfirmationProvider) Test(org.junit.jupiter.api.Test)

Aggregations

DataValidator (com.izforge.izpack.api.installer.DataValidator)14 Test (org.junit.jupiter.api.Test)14 InstallData (com.izforge.izpack.api.data.InstallData)10 File (java.io.File)5 ServerSetupTest (com.icegreen.greenmail.util.ServerSetupTest)3 ConfirmationProvider (com.github.robozonky.api.confirmations.ConfirmationProvider)2 Optional (java.util.Optional)1