Package com.nilhcem.fakesmtp.core.server

Source Code of com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest

package com.nilhcem.fakesmtp.core.server;

import static org.junit.Assert.*;
import org.junit.Test;
import com.nilhcem.fakesmtp.core.exception.BindPortException;
import com.nilhcem.fakesmtp.core.exception.OutOfRangePortException;
import com.nilhcem.fakesmtp.server.SMTPServerHandler;

public class SMTPServerHandlerTest {
  @Test
  public void uniqueInstance() {
    SMTPServerHandler a = SMTPServerHandler.INSTANCE;
    SMTPServerHandler b = SMTPServerHandler.INSTANCE;
    assertSame(a, b);
  }

  @Test(expected = OutOfRangePortException.class)
  public void testOutOfRangePort() throws BindPortException, OutOfRangePortException {
    SMTPServerHandler.INSTANCE.startServer(9999999, null);
  }

  @Test
  public void stopShouldDoNothingIfServerIsAlreadyStopped() {
    SMTPServerHandler.INSTANCE.stopServer();
    SMTPServerHandler.INSTANCE.stopServer();
    SMTPServerHandler.INSTANCE.stopServer();
  }
}
TOP

Related Classes of com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.