Configuration { public void setLoginPageUri(String loginPageUri) { if (loginPageUri != null) { if (loginPageUri.isEmpty()) { throw new IllegalArgumentException("Login page URI cannot be empty."); } else if (loginPageUri.charAt(0) != '/') { throw new IllegalArgumentException("Login page URI must start with a '/'. Instead found '" + loginPageUri.charAt(0) + "' at the beginning."); } } this.loginPageUri = loginPageUri; } Configuration(); Optional<String> getContextPath(); void setContextPath(String contextPath); Optional<String> getThemeName(); void setThemeName(String themeName); Optional<String> getLoginPageUri(); void setLoginPageUri(String loginPageUri); Optional<String> getAuthorizer(); void setAuthorizer(String authorizer); Optional<String> getSessionManagerFactoryClassName(); void setSessionManagerFactoryClassName(String factoryClassName); long getSessionTimeout(); void setSessionTimeout(long sessionTimeout); Optional<String> getErrorPageUri(int httpStatusCode); void setErrorPageUris(Map<Integer, String> errorPageUris); Optional<String> getDefaultErrorPageUri(); void setDefaultErrorPageUri(String defaultErrorPageUri); List<MenuItem> getMenu(String name); void setMenus(List<? extends Menu> menus); Set<UriPatten> getCsrfIgnoreUris(); void setCsrfIgnoreUris(Set<String> csrfIgnoreUris); Set<UriPatten> getXssIgnoreUris(); void setXssIgnoreUris(Set<String> xssIgnoreUris); ResponseHeaders getResponseHeaders(); void setResponseHeaders(ResponseHeaders responseHeaders); Map<String, Object> other(); void setOther(Map<String, Object> other);  }
@Test public void testLoginPageUriValidation() { Configuration configuration = createConfiguration(); Assert.assertThrows(IllegalArgumentException.class, () -> configuration.setLoginPageUri("")); Assert.assertThrows(IllegalArgumentException.class, () -> configuration.setLoginPageUri("a/bc")); configuration.setLoginPageUri(null); configuration.setLoginPageUri("/simple-auth/login"); }