@Test public void shouldCreateSettingsWithNoPassword() throws Exception { NagiosSettings settings = new NagiosSettingsBuilder() .withPassword("set to something as default is empty string") .withNoPassword() .create(); assertEquals(EMPTY, settings.getPassword()); }
@Test public void shouldCreateWithEverythingOverriden() throws Exception { String host = "nagioshost"; int port = 9999; String password = "******"; int connectionTimeout = 1; int responseTimeout = 1; NagiosSettings nagiosSettings = new NagiosSettingsBuilder() .withLargeMessageSupportEnabled() .withNagiosHost(host) .withPort(port) .withPassword(password) .withConnectionTimeout(connectionTimeout) .withResponseTimeout(responseTimeout) .withEncryption(XOR) .withEncryptor(XOR.getEncryptor()) .create(); assertEquals(host, nagiosSettings.getNagiosHost()); assertEquals((long) port, (long) nagiosSettings.getPort()); assertEquals(password, nagiosSettings.getPassword()); assertEquals((long) connectionTimeout, (long) nagiosSettings.getConnectTimeout()); assertEquals((long) responseTimeout, (long) nagiosSettings.getTimeout()); assertEquals(XOR.getEncryptor(), nagiosSettings.getEncryptor()); assertEquals(4096L, (long) nagiosSettings.getMaxMessageSizeInChars()); }