Upgrade JUnit 4.13 to 5.6.1 (#86)
* Upgrade JUnit 4.13 to 5.6.1 * Test build with JDK 13 * Revert "Test build with JDK 13" This reverts commit a5f0acfb91d17373fca943f19ecf4b32ab8ca02a.
This commit is contained in:
parent
6ddd97f025
commit
fbe8d06332
5 changed files with 54 additions and 25 deletions
16
pom.xml
16
pom.xml
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
@ -17,7 +17,7 @@ abstract class AbstractWiserTest {
|
|||
|
||||
private Wiser wiser;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws IOException {
|
||||
port = findFreePort();
|
||||
wiser = new Wiser(port);
|
||||
|
@ -31,7 +31,7 @@ abstract class AbstractWiserTest {
|
|||
}
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
wiser.stop();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package net.kemitix.wiser.assertions;
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -75,14 +76,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* 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"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,14 +107,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* 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"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -133,14 +140,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* 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 = "bob@a.com";
|
||||
//when
|
||||
sendMimeMultipartMessage(from, "to", "subject", "body");
|
||||
//then
|
||||
assertReceivedMessage().from("lisa@c.com");
|
||||
assertThatExceptionOfType(AssertionError.class)
|
||||
.isThrownBy(() ->
|
||||
assertReceivedMessage()
|
||||
.from("lisa@c.com"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +159,8 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
*/
|
||||
@Test
|
||||
public void testInstantiate() {
|
||||
assertNotNull(assertReceivedMessage());
|
||||
assertThat(assertReceivedMessage())
|
||||
.isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -171,14 +182,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* 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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,14 +213,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* 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"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,14 +245,17 @@ public class WiserAssertionsTest extends AbstractWiserTest {
|
|||
* is not sent from a user.
|
||||
*
|
||||
*/
|
||||
@Test(expected = AssertionError.class)
|
||||
@Test
|
||||
public void testToNotMatches() {
|
||||
//given
|
||||
final String to = "carl@b.com";
|
||||
//when
|
||||
sendMimeMultipartMessage("from", to, "subject", "body");
|
||||
//then
|
||||
assertReceivedMessage().to("bob@a.com");
|
||||
assertThatExceptionOfType(AssertionError.class)
|
||||
.isThrownBy(() ->
|
||||
assertReceivedMessage()
|
||||
.to("bob@a.com"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue