// Path: src/main/java/com/github/sleroy/junit/mail/server/MailListener.java
// public final class MailListener implements SimpleMessageListener {
//     private final MailSaverInterface saver;
// 
//     /**
//      * Creates the listener.
//      *
//      * @param saver
//      *            a {@code MailServer} object used to save emails and notify
//      *            components.
//      */
//     public MailListener(final MailSaverInterface saver) {
// 	this.saver = saver;
//     }
// 
//     /**
//      * Accepts all kind of email <i>(always return true)</i>.
//      * <p>
//      * Called once for every RCPT TO during a SMTP exchange.<br>
//      * Each accepted recipient will result in a separate deliver() call later.
//      * </p>
//      *
//      * @param from
//      *            the user who send the email.
//      * @param recipient
//      *            the recipient of the email.
//      * @return always return {@code true}
//      */
//     @Override
//     public boolean accept(final String from, final String recipient) {
// 	return true;
//     }
// 
//     /**
//      * Receives emails and forwards them to the {@link MailSaver} object.
//      */
//     @Override
//     public void deliver(final String from, final String recipient, final InputStream data) throws IOException {
// 	saver.saveEmailAndNotify(from, recipient, data);
//     }
// }
// 
// Path: src/main/java/com/github/sleroy/junit/mail/server/MailSaverInterface.java
// @FunctionalInterface
// public interface MailSaverInterface {
// 
//     /**
//      * Saves incoming email in file system and notifies observers.
//      *
//      * @param from
//      *            the user who send the email.
//      * @param to
//      *            the recipient of the email.
//      * @param data
//      *            an InputStream object containing the email.
//      * @see MailServerModel to see which observers will be notified
//      */
//     void saveEmailAndNotify(String from, String to, InputStream data);
// 
// }


import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.github.sleroy.junit.mail.server.MailListener;
import com.github.sleroy.junit.mail.server.MailSaverInterface;
/**
 * 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;




public class MailListenerTest {

	@Test
	public void testAccept() throws Exception {
// Path: src/main/java/com/github/sleroy/junit/mail/server/MailListener.java
// public final class MailListener implements SimpleMessageListener {
//     private final MailSaverInterface saver;
// 
//     /**
//      * Creates the listener.
//      *
//      * @param saver
//      *            a {@code MailServer} object used to save emails and notify
//      *            components.
//      */
//     public MailListener(final MailSaverInterface saver) {
// 	this.saver = saver;
//     }
// 
//     /**
//      * Accepts all kind of email <i>(always return true)</i>.
//      * <p>
//      * Called once for every RCPT TO during a SMTP exchange.<br>
//      * Each accepted recipient will result in a separate deliver() call later.
//      * </p>
//      *
//      * @param from
//      *            the user who send the email.
//      * @param recipient
//      *            the recipient of the email.
//      * @return always return {@code true}
//      */
//     @Override
//     public boolean accept(final String from, final String recipient) {
// 	return true;
//     }
// 
//     /**
//      * Receives emails and forwards them to the {@link MailSaver} object.
//      */
//     @Override
//     public void deliver(final String from, final String recipient, final InputStream data) throws IOException {
// 	saver.saveEmailAndNotify(from, recipient, data);
//     }
// }
// 
// Path: src/main/java/com/github/sleroy/junit/mail/server/MailSaverInterface.java
// @FunctionalInterface
// public interface MailSaverInterface {
// 
//     /**
//      * Saves incoming email in file system and notifies observers.
//      *
//      * @param from
//      *            the user who send the email.
//      * @param to
//      *            the recipient of the email.
//      * @param data
//      *            an InputStream object containing the email.
//      * @see MailServerModel to see which observers will be notified
//      */
//     void saveEmailAndNotify(String from, String to, InputStream data);
// 
// }


// Path: src/test/java/com/github/sleroy/junit/mail/server/MailListenerTest.java
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import com.github.sleroy.junit.mail.server.MailListener;
import com.github.sleroy.junit.mail.server.MailSaverInterface;

/**
 * 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;




public class MailListenerTest {

	@Test
	public void testAccept() throws Exception {
		MailListener mailListener = new MailListener(Mockito.mock(MailSaverInterface.class));