MockSMTPServer { Port getPort() { return Port.of(server.getPort()); } private  MockSMTPServer(SMTPBehaviorRepository behaviorRepository, ReceivedMailRepository mailRepository, int port); static MockSMTPServer onRandomPort(SMTPBehaviorRepository behaviorRepository, ReceivedMailRepository mailRepository); static MockSMTPServer onPort(SMTPBehaviorRepository behaviorRepository, ReceivedMailRepository mailRepository, Port port);  }
@Test void serverStartShouldOpenASmtpPort() { assertThatCode(() -> new SMTPMessageSender(DOMAIN) .connect("localhost", mockServer.getPort())) .doesNotThrowAnyException(); }