use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class ZonkySettingsValidatorTest method properLogin.
@Test
void properLogin() {
// mock data
final ZonkyApiToken token = mock(ZonkyApiToken.class);
final OAuth oauth = mock(OAuth.class);
when(oauth.login(any(), any())).thenReturn(token);
final Zonky zonky = mock(Zonky.class);
final ApiProvider provider = mockApiProvider(oauth, token, zonky);
// execute SUT
final ZonkySettingsValidator validator = new ZonkySettingsValidator(() -> provider);
final InstallData d = ZonkySettingsValidatorTest.mockInstallData();
final DataValidator.Status result = validator.validateData(d);
// test
assertThat(result).isEqualTo(DataValidator.Status.OK);
verify(oauth).login(eq(ZonkySettingsValidatorTest.USERNAME), eq(ZonkySettingsValidatorTest.PASSWORD.toCharArray()));
verify(zonky).logout();
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class ZonkySettingsValidatorTest method error.
@Test
void error() {
// mock data
final OAuth oauth = mock(OAuth.class);
when(oauth.login(any(), any())).thenThrow(new ServerErrorException(Response.Status.INTERNAL_SERVER_ERROR));
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.ERROR);
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class InstallDirValidatorTest method mockBaseData.
private static InstallData mockBaseData(final String installPath) {
final InstallData data = mock(InstallData.class);
when(data.getVariable(Variables.INSTALL_PATH.getKey())).thenReturn(new File(installPath).getAbsolutePath());
return data;
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class InstallDirValidatorTest method correctDirLinux.
@Test
void correctDirLinux() {
final InstallData d = InstallDirValidatorTest.mockBaseData("/home/lpetrovi/RoboZonky/4.0.0-SNAPSHOT");
final InstallDirValidator v = new InstallDirValidator();
assertThat(v.validateData(d)).isEqualTo(DataValidator.Status.OK);
}
use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class InstallDirValidatorTest method correctDirWindows.
@Test
void correctDirWindows() {
final InstallData d = InstallDirValidatorTest.mockBaseData("C:\\RoboZonky\\4.0.0-SNAPSHOT");
final InstallDirValidator v = new InstallDirValidator();
assertThat(v.validateData(d)).isEqualTo(DataValidator.Status.OK);
}
Aggregations