@Test public void testSetNewPasswordViaQueryParamsShouldFail() throws IOException { configuration.addConfigurationSource(SimpleSource.forTest(passwordKey, "")); try { configurationPasswordChecker.assertPasswordCorrect(""); configuration.save(passwordKey, "", null); fail(); } catch (IllegalArgumentException e) { assertEquals("Config key 'configuration.password' does not exist.", e.getMessage()); } }
public void assertPasswordCorrect(String password) { if (!isPasswordSet()) { throw new IllegalStateException("'" + updateConfigPasswordKey + "' is not set."); } if (!isPasswordCorrect(password)) { throw new IllegalStateException("Wrong password for '" + updateConfigPasswordKey + "'."); } }
ConfigurationPasswordChecker { public void assertPasswordCorrect(String password) { if (!isPasswordSet()) { throw new IllegalStateException("'" + updateConfigPasswordKey + "' is not set."); } if (!isPasswordCorrect(password)) { throw new IllegalStateException("Wrong password for '" + updateConfigPasswordKey + "'."); } } }
ConfigurationPasswordChecker { public void assertPasswordCorrect(String password) { if (!isPasswordSet()) { throw new IllegalStateException("'" + updateConfigPasswordKey + "' is not set."); } if (!isPasswordCorrect(password)) { throw new IllegalStateException("Wrong password for '" + updateConfigPasswordKey + "'."); } } ConfigurationPasswordChecker(ConfigurationRegistry configurationRegistry, String updateConfigPasswordKey); }
ConfigurationPasswordChecker { public void assertPasswordCorrect(String password) { if (!isPasswordSet()) { throw new IllegalStateException("'" + updateConfigPasswordKey + "' is not set."); } if (!isPasswordCorrect(password)) { throw new IllegalStateException("Wrong password for '" + updateConfigPasswordKey + "'."); } } ConfigurationPasswordChecker(ConfigurationRegistry configurationRegistry, String updateConfigPasswordKey); boolean isPasswordCorrect(String password); void assertPasswordCorrect(String password); boolean isPasswordSet(); }
ConfigurationPasswordChecker { public void assertPasswordCorrect(String password) { if (!isPasswordSet()) { throw new IllegalStateException("'" + updateConfigPasswordKey + "' is not set."); } if (!isPasswordCorrect(password)) { throw new IllegalStateException("Wrong password for '" + updateConfigPasswordKey + "'."); } } ConfigurationPasswordChecker(ConfigurationRegistry configurationRegistry, String updateConfigPasswordKey); boolean isPasswordCorrect(String password); void assertPasswordCorrect(String password); boolean isPasswordSet();  }