use of com.izforge.izpack.api.data.InstallData in project robozonky by RoboZonky.
the class StrategySettingsValidatorTest method mockInstallData.
private static InstallData mockInstallData(final URL u) {
final InstallData data = StrategySettingsValidatorTest.mockInstallData();
when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("url");
when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))).thenReturn(u.toExternalForm());
return data;
}
use of com.izforge.izpack.api.data.InstallData 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.data.InstallData in project robozonky by RoboZonky.
the class StrategySettingsValidatorTest method mockInstallData.
private static InstallData mockInstallData(final File f) {
final InstallData data = StrategySettingsValidatorTest.mockInstallData();
when(data.getVariable(eq(Variables.STRATEGY_TYPE.getKey()))).thenReturn("file");
when(data.getVariable(eq(Variables.STRATEGY_SOURCE.getKey()))).thenReturn(f.getAbsolutePath());
return data;
}
use of com.izforge.izpack.api.data.InstallData 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.data.InstallData in project robozonky by RoboZonky.
the class VariablesTest method readValue.
@Test
void readValue() {
for (final Variables variable : Variables.values()) {
final String key = variable.getKey();
final String value = UUID.randomUUID().toString();
final InstallData data = mock(InstallData.class);
when(data.getVariable(key)).thenReturn(value);
assertThat(variable.getValue(data)).isSameAs(value);
}
}
Aggregations