import static net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
setupIntValue("PositiveTrust", 50);
setupIntValue("NegativeTrust", -50);
when(configuration.getStringValue("Option/TrustComment")).thenReturn(
- new TestValue<String>("Trusted"));
+ TestValue.from("Trusted"));
setupBooleanValue("ActivateFcpInterface", true);
setupIntValue("FcpFullAccessRequired", 1);
}
private void setupIntValue(String optionName, int value) {
when(configuration.getIntValue("Option/" + optionName)).thenReturn(
- new TestValue<Integer>(value));
+ TestValue.from(value));
}
private void setupBooleanValue(String optionName, boolean value) {
when(configuration.getBooleanValue(
"Option/" + optionName)).thenReturn(
- new TestValue<Boolean>(value));
+ TestValue.from(value));
}
@Test
assertThat(preferences.getFcpFullAccessRequired(), is(WRITING));
}
+ @Test
+ public void configurationIsLoadedCorrectlyWithCutOffLengthMinusOne() {
+ setupConfiguration();
+ setupIntValue("PostCutOffLength", -1);
+ preferencesLoader.loadFrom(configuration);
+ assertThat(preferences.getPostCutOffLength(), not(is(-1)));
+ }
+
}