Skip to content

Commit

Permalink
Migrate to Junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoss committed Apr 8, 2021
1 parent 9d379db commit 72ef8ba
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 49 deletions.
12 changes: 6 additions & 6 deletions src/test/java/com/jcabi/email/EnvelopeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import javax.mail.internet.MimeMessage;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
Expand All @@ -52,14 +52,14 @@
* @since 1.4
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class EnvelopeTest {
final class EnvelopeTest {

/**
* Envelope.Constant can cache.
* @throws Exception If fails
*/
@Test
public void cachesPreviousCall() throws Exception {
void cachesPreviousCall() throws Exception {
final Envelope origin = Mockito.mock(Envelope.class);
Mockito.doReturn(
new MimeMessage(Session.getDefaultInstance(new Properties()))
Expand All @@ -76,7 +76,7 @@ public void cachesPreviousCall() throws Exception {
* string.
*/
@Test
public void handlesUnicodeCorrectly() throws Exception {
void handlesUnicodeCorrectly() throws Exception {
final Envelope env = new Envelope.Mime()
.with(new StSender("from <test-from@jcabi.com>"))
.with(new StRecipient("to", "test-to@jcabi.com"))
Expand Down Expand Up @@ -110,7 +110,7 @@ public void handlesUnicodeCorrectly() throws Exception {
* @throws Exception If fails
*/
@Test
public void wrapsAnotherEnvelope() throws Exception {
void wrapsAnotherEnvelope() throws Exception {
final Envelope origin = new Envelope.Mime().with(
new StSender("jack@example.com")
);
Expand All @@ -132,7 +132,7 @@ public void wrapsAnotherEnvelope() throws Exception {
* @throws Exception If fails
*/
@Test
public void wrapsAnotherEnvelopeWithEnclosures() throws Exception {
void wrapsAnotherEnvelopeWithEnclosures() throws Exception {
final Envelope origin = new Envelope.Mime().with(
new EnPlain("first enclosure")
);
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/jcabi/email/enclosure/EnHtmlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
import javax.mail.internet.MimeBodyPart;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link EnHtml}.
*
* @since 1.8.2
*/
public final class EnHtmlTest {
final class EnHtmlTest {

/**
* EnPlain can create a plain MIME part with custom encoding.
* @throws Exception If fails
*/
@Test
public void createsHtmlMimePartWithCustomEncoding() throws Exception {
void createsHtmlMimePartWithCustomEncoding() throws Exception {
final String charset = "KOI8-R";
final MimeBodyPart part = new EnHtml(
"<p>hello, приятель</p>",
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/enclosure/EnPlainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
import javax.mail.internet.MimeBodyPart;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link EnPlain}.
*
* @since 1.3.2
*/
public final class EnPlainTest {
final class EnPlainTest {

/**
* EnPlain can create a plain MIME part.
* @throws Exception If fails
*/
@Test
public void createsPlainMimePart() throws Exception {
void createsPlainMimePart() throws Exception {
final MimeBodyPart part = new EnPlain("hello, друг").part();
MatcherAssert.assertThat(
part.getContent().toString(),
Expand All @@ -60,7 +60,7 @@ public void createsPlainMimePart() throws Exception {
* @throws Exception If fails
*/
@Test
public void createsPlainMimePartWithCustomEncoding() throws Exception {
void createsPlainMimePartWithCustomEncoding() throws Exception {
final String charset = "KOI8-R";
final MimeBodyPart part = new EnPlain(
"hello, приятель",
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/postman/PostNoLoopsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
import com.jcabi.email.Postman;
import com.jcabi.email.stamp.StRecipient;
import com.jcabi.email.stamp.StSender;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

/**
* Test case for {@link PostNoLoops}.
*
* @since 1.6
*/
public final class PostNoLoopsTest {
final class PostNoLoopsTest {

/**
* PostNoLoops can ignore messages.
* @throws Exception If fails
*/
@Test
@SuppressWarnings("unchecked")
public void ignoresLoopMessages() throws Exception {
void ignoresLoopMessages() throws Exception {
final Postman post = Mockito.mock(Postman.class);
final String email = "test@example.com";
new PostNoLoops(post).send(
Expand All @@ -67,7 +67,7 @@ public void ignoresLoopMessages() throws Exception {
*/
@Test
@SuppressWarnings("unchecked")
public void doesntTouchNormalMessages() throws Exception {
void doesntTouchNormalMessages() throws Exception {
final Postman post = Mockito.mock(Postman.class);
new PostNoLoops(post).send(
new Envelope.Mime()
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/stamp/StBccTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
import javax.mail.internet.MimeUtility;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link StBcc}.
*
* @since 1.3.1
*/
public final class StBccTest {
final class StBccTest {

/**
* StBCC can add a BCC recipient to the message.
* @throws Exception If fails
*/
@Test
public void addsCopyToMessage() throws Exception {
void addsCopyToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand All @@ -77,7 +77,7 @@ public void addsCopyToMessage() throws Exception {
* @throws Exception If fails
*/
@Test
public void addsCopyToMessageWithCustomCharset() throws Exception {
void addsCopyToMessageWithCustomCharset() throws Exception {
final String charset = "KOI8-R";
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/stamp/StCcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
import javax.mail.internet.MimeUtility;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link StCc}.
*
* @since 1.3.1
*/
public final class StCcTest {
final class StCcTest {

/**
* StCC can add a CC recipient to the message.
* @throws Exception If fails
*/
@Test
public void addsCopyToMessage() throws Exception {
void addsCopyToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand All @@ -77,7 +77,7 @@ public void addsCopyToMessage() throws Exception {
* @throws Exception If fails
*/
@Test
public void addsCopyToMessageWithCustomCharset() throws Exception {
void addsCopyToMessageWithCustomCharset() throws Exception {
final String charset = "KOI8-R";
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/jcabi/email/stamp/StHeaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@
import javax.mail.internet.MimeMessage;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link StHeader}.
*
* @since 1.6.2
*/
public final class StHeaderTest {
final class StHeaderTest {

/**
* StHeader can add a header to the message.
* @throws Exception If fails
*/
@Test
public void addsHeaderToMessage() throws Exception {
void addsHeaderToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/stamp/StRecipientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
import javax.mail.internet.MimeUtility;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link com.jcabi.email.stamp.StRecipient}.
*
* @since 1.3.1
*/
public final class StRecipientTest {
final class StRecipientTest {

/**
* StRecipient can add a recipient to the message.
* @throws Exception If fails
*/
@Test
public void addsRecipientToMessage() throws Exception {
void addsRecipientToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand All @@ -72,7 +72,7 @@ public void addsRecipientToMessage() throws Exception {
* @throws Exception If fails
*/
@Test
public void addsRecipientToMessageWithCustomCharset() throws Exception {
void addsRecipientToMessageWithCustomCharset() throws Exception {
final String charset = "KOI8-R";
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/jcabi/email/stamp/StReplyToTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@
import javax.mail.internet.MimeMessage;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link StReplyTo}.
*
* @since 1.8
*/
public final class StReplyToTest {
final class StReplyToTest {

/**
* StReplyTo can attach the reply to address to a message.
* @throws Exception If something goes wrong.
*/
@Test
public void addsReplyToAddressToMessage() throws Exception {
void addsReplyToAddressToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/stamp/StSenderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@
import javax.mail.internet.MimeUtility;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link com.jcabi.email.stamp.StSender}.
*
* @since 1.3.1
*/
public final class StSenderTest {
final class StSenderTest {

/**
* StSender can add a sender to the message.
* @throws Exception If fails
*/
@Test
public void addsSenderToMessage() throws Exception {
void addsSenderToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand All @@ -70,7 +70,7 @@ public void addsSenderToMessage() throws Exception {
* @throws Exception If fails
*/
@Test
public void addsSenderToMessageWithCustomCharset() throws Exception {
void addsSenderToMessageWithCustomCharset() throws Exception {
final String charset = "KOI8-R";
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/com/jcabi/email/stamp/StSubjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@
import javax.mail.internet.MimeUtility;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link com.jcabi.email.stamp.StSubject}.
*
* @since 1.3.1
*/
public final class StSubjectTest {
final class StSubjectTest {

/**
* StSubject can add a subject to the message.
* @throws Exception If fails
*/
@Test
public void addsSubjectToMessage() throws Exception {
void addsSubjectToMessage() throws Exception {
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
);
Expand All @@ -67,7 +67,7 @@ public void addsSubjectToMessage() throws Exception {
* @throws Exception If fails
*/
@Test
public void addsSubjectToMessageWithCustomEncoding() throws Exception {
void addsSubjectToMessageWithCustomEncoding() throws Exception {
final String charset = "KOI8-R";
final Message msg = new MimeMessage(
Session.getDefaultInstance(new Properties())
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/jcabi/email/wire/SmtpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@
import javax.mail.internet.MimeMessage;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Test case for {@link Smtp}.
* @since 1.0
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
*/
public final class SmtpTest {
final class SmtpTest {

/**
* SMTP postman can send email through SMTP wire.
* @throws Exception If fails
*/
@Test
public void sendsEmailToSmtpServer() throws Exception {
void sendsEmailToSmtpServer() throws Exception {
final String bind = "localhost";
final int received = 3;
final int port = SmtpTest.port();
Expand Down
Loading

0 comments on commit 72ef8ba

Please sign in to comment.