// Path: src/main/java/com/github/sleroy/junit/mail/server/SMTPAuthHandler.java
// final class SMTPAuthHandler implements AuthenticationHandler {
//     public static final String USER_IDENTITY = "User";
// 
//     private int pass = 0;
// 
//     private final String userName;
// 
//     private final String password;
// 
//     public SMTPAuthHandler(final String userName, final String password) {
// 	super();
// 	this.userName = userName;
// 	this.password = password;
//     }
// 
//     /**
//      * Simulates an authentication process.
//      * <p>
//      * <ul>
//      * <li>first prompts for username;</li>
//      * <li>then, prompts for password;</li>
//      * <li>finally, returns {@code null} to finish the authentication
//      * process;</li>
//      * </ul>
//      * </p>
//      *
//      * @return <code>null</code> if the authentication process is finished,
//      *         otherwise a string to hand back to the client.
//      * @param clientInput
//      *            The client's input, eg "AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ="
//      */
//     @Override
//     public String auth(final String clientInput) {
// 	String prompt;
// 
// 	if (++pass == 1) {
// 	    prompt = userName;
// 	} else if (pass == 2) {
// 	    prompt = password;
// 	} else {
// 	    pass = 0;
// 	    prompt = null;
// 	}
// 	return prompt;
//     }
// 
//     /**
//      * If the authentication process was successful, this returns the identity
//      * of the user. The type defining the identity can vary depending on the
//      * authentication mechanism used, but typically this returns a String
//      * username. If authentication was not successful, the return value is
//      * undefined.
//      */
//     @Override
//     public Object getIdentity() {
// 	return SMTPAuthHandler.USER_IDENTITY;
//     }
// }


import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import com.github.sleroy.junit.mail.server.SMTPAuthHandler;
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package com.github.sleroy.junit.mail.server;



@RunWith(MockitoJUnitRunner.class)
public class SMTPAuthHandlerTest {
	private String password = "password";
	private String userName = "username";

// Path: src/main/java/com/github/sleroy/junit/mail/server/SMTPAuthHandler.java
// final class SMTPAuthHandler implements AuthenticationHandler {
//     public static final String USER_IDENTITY = "User";
// 
//     private int pass = 0;
// 
//     private final String userName;
// 
//     private final String password;
// 
//     public SMTPAuthHandler(final String userName, final String password) {
// 	super();
// 	this.userName = userName;
// 	this.password = password;
//     }
// 
//     /**
//      * Simulates an authentication process.
//      * <p>
//      * <ul>
//      * <li>first prompts for username;</li>
//      * <li>then, prompts for password;</li>
//      * <li>finally, returns {@code null} to finish the authentication
//      * process;</li>
//      * </ul>
//      * </p>
//      *
//      * @return <code>null</code> if the authentication process is finished,
//      *         otherwise a string to hand back to the client.
//      * @param clientInput
//      *            The client's input, eg "AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ="
//      */
//     @Override
//     public String auth(final String clientInput) {
// 	String prompt;
// 
// 	if (++pass == 1) {
// 	    prompt = userName;
// 	} else if (pass == 2) {
// 	    prompt = password;
// 	} else {
// 	    pass = 0;
// 	    prompt = null;
// 	}
// 	return prompt;
//     }
// 
//     /**
//      * If the authentication process was successful, this returns the identity
//      * of the user. The type defining the identity can vary depending on the
//      * authentication mechanism used, but typically this returns a String
//      * username. If authentication was not successful, the return value is
//      * undefined.
//      */
//     @Override
//     public Object getIdentity() {
// 	return SMTPAuthHandler.USER_IDENTITY;
//     }
// }


// Path: src/test/java/com/github/sleroy/junit/mail/server/SMTPAuthHandlerTest.java
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import com.github.sleroy.junit.mail.server.SMTPAuthHandler;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package com.github.sleroy.junit.mail.server;



@RunWith(MockitoJUnitRunner.class)
public class SMTPAuthHandlerTest {
	private String password = "password";
	private String userName = "username";

	private SMTPAuthHandler SMTPAuthHandler = new SMTPAuthHandler(userName, password);