Skip to content
This repository has been archived by the owner on Jan 22, 2023. It is now read-only.

Upgrade JUnit 4.13 to 5.6.1 #86

Merged
merged 3 commits into from
Mar 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
</scm>

<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<tiles-maven-plugin.version>2.16</tiles-maven-plugin.version>
<kemitix-maven-tiles.version>2.1.2</kemitix-maven-tiles.version>
<kemitix-tiles.version>0.9.0</kemitix-tiles.version>
Expand All @@ -42,7 +45,7 @@

<javax-mail.version>1.4.7</javax-mail.version>
<subethasmtp.version>3.1.7</subethasmtp.version>
<junit.version>4.13</junit.version>
<junit.version>5.6.1</junit.version>
<mockito-core.version>3.3.3</mockito-core.version>
<simple-java-mail.version>3.1.1</simple-java-mail.version>
<spring-framework.version>5.2.4.RELEASE</spring-framework.version>
Expand All @@ -52,6 +55,7 @@
<jacoco-class-missed-count-maximum>1</jacoco-class-missed-count-maximum>
<mon.version>2.1.0</mon.version>
<spotbugs.version>4.0.1</spotbugs.version>
<assertj.version>3.15.0</assertj.version>
</properties>

<dependencies>
Expand All @@ -71,8 +75,8 @@
<version>${subethasmtp.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
Expand All @@ -82,6 +86,12 @@
<version>${mockito-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency><!-- for Issue1Test -->
<groupId>org.codemonkey.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package net.kemitix.wiser.assertions;

import org.junit.After;
import org.junit.Before;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.subethamail.wiser.Wiser;

import java.io.IOException;
Expand All @@ -17,7 +17,7 @@ abstract class AbstractWiserTest {

private Wiser wiser;

@Before
@BeforeEach
public void setUp() throws IOException {
port = findFreePort();
wiser = new Wiser(port);
Expand All @@ -31,7 +31,7 @@ private int findFreePort() throws IOException {
}
}

@After
@AfterEach
public void tearDown() {
wiser.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/kemitix/wiser/assertions/Issue1Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.codemonkey.simplejavamail.Mailer;
import org.codemonkey.simplejavamail.email.Email;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import javax.mail.Message;

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/net/kemitix/wiser/assertions/Issue6Test.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.kemitix.wiser.assertions;

import org.junit.Test;

import org.junit.jupiter.api.Test;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;

Expand Down
50 changes: 35 additions & 15 deletions src/test/java/net/kemitix/wiser/assertions/WiserAssertionsTest.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package net.kemitix.wiser.assertions;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.subethamail.wiser.Wiser;

import static org.junit.Assert.assertNotNull;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;

import java.io.IOException;
import java.util.logging.Level;
Expand Down Expand Up @@ -75,14 +76,17 @@ public void testContentMatches() {
* Test {@link WiserAssertions#withContent(java.lang.String)} where the
* content of the email does not match.
*/
@Test(expected = AssertionError.class)
@Test
public void testContentNotMatches() {
//given
final String body = "message body";
//when
sendMimeMultipartMessage("from", "to", "subject", body);
//then
assertReceivedMessage().withContent("Other body");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.withContent("Other body"));
}

/**
Expand All @@ -103,14 +107,17 @@ public void testContentContainsMatches() {
* Test {@link WiserAssertions#withContentContains(String)} where the
* content of the email does not match.
*/
@Test(expected = AssertionError.class)
@Test
public void testContentContainsNotMatches() {
//given
final String body = "message body";
//when
sendMimeMultipartMessage("from", "to", "subject", body);
//then
assertReceivedMessage().withContentContains("agebo");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.withContentContains("agebo"));
}

/**
Expand All @@ -133,14 +140,17 @@ public void testFromMatches() throws IOException {
* Test {@link WiserAssertions#from(java.lang.String)} can detect when mail
* is not sent from a user.
*/
@Test(expected = AssertionError.class)
@Test
public void testFromNotMatches() {
//given
final String from = "[email protected]";
//when
sendMimeMultipartMessage(from, "to", "subject", "body");
//then
assertReceivedMessage().from("[email protected]");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.from("[email protected]"));
}

/**
Expand All @@ -149,7 +159,8 @@ public void testFromNotMatches() {
*/
@Test
public void testInstantiate() {
assertNotNull(assertReceivedMessage());
assertThat(assertReceivedMessage())
.isNotNull();
}

/**
Expand All @@ -171,14 +182,17 @@ public void testSubjectContainsMatches() {
* Test {@link WiserAssertions#withSubjectContains(java.lang.String)} where
* the subject does not contain the expected fragment.
*/
@Test(expected = AssertionError.class)
@Test
public void testSubjectContainsNotMatches() {
//given
final String fragment = "foo";
//when
sendMimeMultipartMessage("from", "to", "subject tail", "body");
//then
assertReceivedMessage().withSubjectContains(fragment);
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.withSubjectContains(fragment));
}

/**
Expand All @@ -199,14 +213,17 @@ public void testSubjectMatches() {
* Test {@link WiserAssertions#withSubject(java.lang.String)} where the
* message does not have the subject expected.
*/
@Test(expected = AssertionError.class)
@Test
public void testSubjectNotMatches() {
//given
final String subject = "message subject";
//when
sendMimeMultipartMessage("from", "to", subject, "body");
//then
assertReceivedMessage().withSubject("other subject");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.withSubject("other subject"));
}

/**
Expand All @@ -228,14 +245,17 @@ public void testToMatches() {
* is not sent from a user.
*
*/
@Test(expected = AssertionError.class)
@Test
public void testToNotMatches() {
//given
final String to = "[email protected]";
//when
sendMimeMultipartMessage("from", to, "subject", "body");
//then
assertReceivedMessage().to("[email protected]");
assertThatExceptionOfType(AssertionError.class)
.isThrownBy(() ->
assertReceivedMessage()
.to("[email protected]"));
}

}