use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class ZonkoidSettingsValidatorTest method mockInstallData.
private static InstallData mockInstallData() {
final InstallData d = mock(InstallData.class);
when(d.getVariable(Variables.ZONKY_USERNAME.getKey())).thenReturn(ZonkoidSettingsValidatorTest.USER);
when(d.getVariable(Variables.ZONKOID_TOKEN.getKey())).thenReturn(ZonkoidSettingsValidatorTest.TOKEN);
return d;
}
use of com.izforge.izpack.api.data.InstallData 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.data.InstallData 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);
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class ZonkySettingsValidatorTest method mockInstallData.
private static InstallData mockInstallData() {
final InstallData d = mock(InstallData.class);
when(d.getVariable(Variables.ZONKY_USERNAME.getKey())).thenReturn(ZonkySettingsValidatorTest.USERNAME);
when(d.getVariable(Variables.ZONKY_PASSWORD.getKey())).thenReturn(ZonkySettingsValidatorTest.PASSWORD);
return d;
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class ZonkySettingsValidatorTest method warning.
@Test
void warning() {
// mock data
final OAuth oauth = mock(OAuth.class);
when(oauth.login(any(), any())).thenThrow(new IllegalStateException());
final ApiProvider provider = mockApiProvider(oauth);
final InstallData d = ZonkySettingsValidatorTest.mockInstallData();
// execute SUT
final ZonkySettingsValidator validator = new ZonkySettingsValidator(() -> provider);
final DataValidator.Status result = validator.validateData(d);
// test
assertThat(result).isEqualTo(DataValidator.Status.WARNING);
}
Aggregations