You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/02/09 04:29:39 UTC
[james-project] 11/33: [REFACTORING] Get rid of some JUNIT 4 usages
in spamassassin tests
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 66e5c3efbc933804cf5674778741dd0d9501d45d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Feb 6 12:30:18 2021 +0700
[REFACTORING] Get rid of some JUNIT 4 usages in spamassassin tests
---
.../james/spamassassin/SpamAssassinResultTest.java | 33 ++++++++++------------
1 file changed, 15 insertions(+), 18 deletions(-)
diff --git a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinResultTest.java b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinResultTest.java
index 470f8c9..f738b8b 100644
--- a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinResultTest.java
+++ b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/SpamAssassinResultTest.java
@@ -23,17 +23,12 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
public class SpamAssassinResultTest {
-
- @Rule
- public JUnitSoftAssertions softly = new JUnitSoftAssertions();
-
@Test
- public void buildShouldThrowWhenHitsIsNotGiven() {
+ void buildShouldThrowWhenHitsIsNotGiven() {
assertThatThrownBy(() -> SpamAssassinResult.asSpam()
.requiredHits("4.0")
.build())
@@ -41,7 +36,7 @@ public class SpamAssassinResultTest {
}
@Test
- public void buildShouldThrowWhenRequiredHitsIsNotGiven() {
+ void buildShouldThrowWhenRequiredHitsIsNotGiven() {
assertThatThrownBy(() -> SpamAssassinResult.asSpam()
.hits("4.0")
.build())
@@ -49,7 +44,7 @@ public class SpamAssassinResultTest {
}
@Test
- public void buildShouldWork() {
+ void buildShouldWork() {
String hits = "1.1";
String requiredHits = "5.0";
@@ -58,16 +53,18 @@ public class SpamAssassinResultTest {
.requiredHits(requiredHits)
.build();
- softly.assertThat(spamAssassinResult.getHits()).isEqualTo(hits);
- softly.assertThat(spamAssassinResult.getRequiredHits()).isEqualTo(requiredHits);
- softly.assertThat(spamAssassinResult.getHeadersAsAttributes())
- .containsOnly(
- new Attribute(SpamAssassinResult.FLAG_MAIL, AttributeValue.of("YES")),
- new Attribute(SpamAssassinResult.STATUS_MAIL, AttributeValue.of("Yes, hits=1.1 required=5.0")));
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(spamAssassinResult.getHits()).isEqualTo(hits);
+ softly.assertThat(spamAssassinResult.getRequiredHits()).isEqualTo(requiredHits);
+ softly.assertThat(spamAssassinResult.getHeadersAsAttributes())
+ .containsOnly(
+ new Attribute(SpamAssassinResult.FLAG_MAIL, AttributeValue.of("YES")),
+ new Attribute(SpamAssassinResult.STATUS_MAIL, AttributeValue.of("Yes, hits=1.1 required=5.0")));
+ });
}
@Test
- public void headersAsAttributeShouldContainSpamHeaderWithYESValueWhenBuiltAsSpam() {
+ void headersAsAttributeShouldContainSpamHeaderWithYESValueWhenBuiltAsSpam() {
String hits = "1.1";
String requiredHits = "5.0";
@@ -81,7 +78,7 @@ public class SpamAssassinResultTest {
}
@Test
- public void headersAsAttributeShouldContainSpamHeaderWithNOValueWhenBuiltAsHam() {
+ void headersAsAttributeShouldContainSpamHeaderWithNOValueWhenBuiltAsHam() {
String hits = "1.1";
String requiredHits = "5.0";
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org