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