/** Tests the {@link PlainSaslServer#getAuthorizationID()} to retrieve the correct user. */
 @Test
 public void userPasswordReceiveTest() throws Exception {
   String testUser = "******";
   String password = "******";
   mPlainSaslServer.evaluateResponse(getUserInfo(testUser, password));
   Assert.assertEquals(testUser, mPlainSaslServer.getAuthorizationID());
 }
  /*
   * Tests the {@link PlainSaslServer#evaluateResponse(byte[])} method when AuthorizeCallback is
   * not authorized.
   */
  @Test
  public void unauthorizedCallbackTest() throws Exception {
    String testUser = "******";
    String password = "******";
    mPlainSaslServer = new PlainSaslServer(new MockCallbackHandlerUnauthorized());

    mThrown.expect(SaslException.class);
    mThrown.expectMessage("Plain authentication failed: AuthorizeCallback authorized failure");
    mPlainSaslServer.evaluateResponse(getUserInfo(testUser, password));
  }
 /** Tests the {@link PlainSaslServer#getAuthorizationID()} method. */
 @Test
 public void authenticationNotCompleteTest() {
   mThrown.expect(IllegalStateException.class);
   mThrown.expectMessage("PLAIN authentication not completed");
   mPlainSaslServer.getAuthorizationID();
 }
 /**
  * Tests the {@link PlainSaslServer#evaluateResponse(byte[])} method when the password is not set.
  */
 @Test
 public void passwordIsNotSetTest() throws Exception {
   mThrown.expect(SaslException.class);
   mThrown.expectMessage("Plain authentication failed: No password provided");
   mPlainSaslServer.evaluateResponse(getUserInfo("tachyon", ""));
 }
 /**
  * Tests the {@link PlainSaslServer#evaluateResponse(byte[])} method when the user is not set.
  *
  * @throws Exception if the bytes for the user and password cannot be retrieved
  */
 @Test
 public void userIsNotSetTest() throws Exception {
   mThrown.expect(SaslException.class);
   mThrown.expectMessage("Plain authentication failed: No authentication identity provided");
   mPlainSaslServer.evaluateResponse(getUserInfo("", "anonymous"));
 }