{
when(_authenticationProvider.authenticate(_testSaslServer, _saslResponseBytes)).thenReturn(_authenticationResult);
when(_testSaslServer.isComplete()).thenReturn(true);
when(_testSaslServer.getAuthorizationID()).thenReturn(USERNAME);
SubjectAuthenticationResult result = _subjectCreator.authenticate(_testSaslServer, _saslResponseBytes);
final Subject actualSubject = result.getSubject();
assertEquals("Should contain one user principal and two groups ", 3, actualSubject.getPrincipals().size());
assertTrue(actualSubject.getPrincipals().contains(new AuthenticatedPrincipal(_userPrincipal)));
assertTrue(actualSubject.getPrincipals().contains(_group1));
assertTrue(actualSubject.getPrincipals().contains(_group2));