Skip to content
Permalink
Browse files
MIME4J-290 Fix build for recent mvn and JDK versions (#35)
* [MIME4J-290] Fix build for recent mvn and JDK versions

* Remove unneed import
  • Loading branch information
rockwotj committed Mar 30, 2021
1 parent 085d761 commit 0d50be64c61b53d542071f0414ccbc465acf7149
Showing 3 changed files with 19 additions and 16 deletions.
@@ -78,7 +78,6 @@ public void testLenientCharsetHandling() throws Exception {
"iso-8589-0",
"iso-8814-4",
"iso-8859-1 name=FAQ.htm",
"iso-8859-16",
"iso-8859-1?",
"iso-8859-8-i",
"iso-9284-4",
@@ -19,7 +19,7 @@
package org.apache.james.mime4j.utils.search;

import com.google.common.collect.Lists;
import com.sun.org.apache.bcel.internal.util.ClassLoader;
import java.io.InputStream;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
@@ -33,7 +33,7 @@ public void isFoundInShouldBeAbleToLocateTextFragments() throws Exception {
.caseInsensitive(true)
.includeHeaders(false)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -43,7 +43,7 @@ public void isFoundInShouldReturnFalseWhenTextIsAbsent() throws Exception {
.caseInsensitive(true)
.includeHeaders(false)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isFalse();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isFalse();
}

@Test
@@ -53,7 +53,7 @@ public void isFoundInShouldReturnFalseWhenSearchingHeaderTextOutsideHeaders() th
.caseInsensitive(true)
.includeHeaders(false)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isFalse();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isFalse();
}

@Test
@@ -64,7 +64,7 @@ public void isFoundInShouldReturnFalseWhenSearchingTextLocatedInOtherMimeParts()
.includeHeaders(false)
.contentTypes(Lists.newArrayList("invalid"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isFalse();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isFalse();
}

@Test
@@ -75,7 +75,7 @@ public void isFoundInShouldReturnTrueWhenSearchingTextLocatedInSpecifiedMimePart
.includeHeaders(false)
.contentTypes(Lists.newArrayList("text/plain"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -86,7 +86,7 @@ public void isFoundInShouldBeAbleToRecognizedMimeTypes() throws Exception {
.includeHeaders(false)
.contentTypes(Lists.newArrayList("text/plain"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -97,7 +97,7 @@ public void isFoundInShouldNotBeAffectedByInvalidMimeTypes() throws Exception {
.includeHeaders(false)
.contentTypes(Lists.newArrayList("text/plain", "invalid"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -108,7 +108,7 @@ public void caseSensitivenessShouldBeTakenIntoAccountWhenTurnedOn() throws Excep
.includeHeaders(false)
.contentTypes(Lists.newArrayList("text/plain", "invalid"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -119,7 +119,7 @@ public void caseSensitivenessShouldBeIgnoredWhenTurnedOff() throws Exception {
.includeHeaders(false)
.contentTypes(Lists.newArrayList("text/plain", "invalid"))
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isFalse();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isFalse();
}

@Test
@@ -130,7 +130,7 @@ public void headerShouldBeMatchedWhenHeaderMatchingIsTurnedOn() throws Exception
.includeHeaders(true)
.contentTypes(Lists.<String>newArrayList())
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -139,7 +139,7 @@ public void headerShouldBeMatchedWhenIgnoringMime() throws Exception {
.searchContents(Lists.<CharSequence>newArrayList("message/rfc822"))
.ignoringMime(true)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -148,7 +148,7 @@ public void isFoundInIgnoringMimeShouldIgnoreMimeStructure() throws Exception {
.searchContents(Lists.<CharSequence>newArrayList("ail signature )\n\n--------------0004"))
.ignoringMime(true)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isTrue();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isTrue();
}

@Test
@@ -157,7 +157,11 @@ public void isFoundInIgnoringMimeShouldReturnFalseOnNonContainedText() throws Ex
.searchContents(Lists.<CharSequence>newArrayList("invalid"))
.ignoringMime(true)
.build();
assertThat(messageMatcher.messageMatches(ClassLoader.getSystemResourceAsStream("sampleMail.msg"))).isFalse();
assertThat(messageMatcher.messageMatches(getResourceStream("sampleMail.msg"))).isFalse();
}

private InputStream getResourceStream(String resourceName) {
return ClassLoader.getSystemClassLoader().getResourceAsStream(resourceName);
}

}
@@ -201,7 +201,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>5.1.1</version>
<extensions>true</extensions>
</plugin>
<plugin>

0 comments on commit 0d50be6

Please sign in to comment.