WaffleAuthenticatorBase extends AuthenticatorBase { public void setProtocols(final String value) { this.protocols = new LinkedHashSet<>(); final String[] protocolNames = value.split(",", -1); for (String protocolName : protocolNames) { protocolName = protocolName.trim(); if (!protocolName.isEmpty()) { this.log.debug("init protocol: {}", protocolName); if (WaffleAuthenticatorBase.SUPPORTED_PROTOCOLS.contains(protocolName)) { this.protocols.add(protocolName); } else { this.log.error("unsupported protocol: {}", protocolName); throw new RuntimeException("Unsupported protocol: " + protocolName); } } } }  int getContinueContextsTimeout(); void setContinueContextsTimeout(final int continueContextsTimeout); IWindowsAuthProvider getAuth(); void setAuth(final IWindowsAuthProvider provider); @Override String getInfo(); void setPrincipalFormat(final String format); PrincipalFormat getPrincipalFormat(); void setRoleFormat(final String format); PrincipalFormat getRoleFormat(); boolean isAllowGuestLogin(); void setAllowGuestLogin(final boolean value); void setProtocols(final String value);  }
@Test void should_accept_both_protocols() { this.waffleAuthenticatorBase.setProtocols(" NTLM , , Negotiate "); Assertions.assertEquals(2, this.waffleAuthenticatorBase.protocols.size(), "Two protocols added"); Assertions.assertTrue(this.waffleAuthenticatorBase.protocols.contains("NTLM"), "NTLM has been added"); Assertions.assertTrue(this.waffleAuthenticatorBase.protocols.contains("Negotiate"), "Negotiate has been added"); }
@Test void should_accept_Negotiate_protocol() { this.waffleAuthenticatorBase.setProtocols(" Negotiate "); Assertions.assertEquals(1, this.waffleAuthenticatorBase.protocols.size(), "One protocol added"); Assertions.assertEquals("Negotiate", this.waffleAuthenticatorBase.protocols.iterator().next()); }
@Test void should_accept_NTLM_protocol() { this.waffleAuthenticatorBase.setProtocols(" NTLM "); Assertions.assertEquals(1, this.waffleAuthenticatorBase.protocols.size(), "One protocol added"); Assertions.assertEquals("NTLM", this.waffleAuthenticatorBase.protocols.iterator().next()); }
@Test void should_refuse_other_protocol() { Assertions.assertThrows(RuntimeException.class, () -> { this.waffleAuthenticatorBase.setProtocols(" NTLM , OTHER, Negotiate "); }); }