@Test public void returnsTrueIfAuthenticationCredentialsMatch() { Authenticator authenticator = new Authenticator("username", "password"); String encodedCredentials = encodeCredentials("username:password"); assertThat(authenticator.validAuthentication(encodedCredentials), is(true)); }
@Test public void returnsFalseIfAuthenticationFails() { Authenticator authenticator = new Authenticator("username", "password"); String encodedCredentials = encodeCredentials("invalid-user:invalid-password"); assertThat(authenticator.validAuthentication(encodedCredentials), is(false)); }