Skip to content

Commit 5b411b6

Browse files
authored
CODEC-285 Better StringEncoderAbstractTest testEncodeNull (#41)
* CODEC-284 update to hamcrest v2.2 * CODEC-285 update to junit v5.6.0 * CODEC-285 update to junit v5.8.2 via junit-bom * StringEncoderAbstractTest.testEncodeNull no test actually throw EncoderException
1 parent 0169c17 commit 5b411b6

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ limitations under the License.
274274
<properties>
275275
<maven.compiler.source>1.8</maven.compiler.source>
276276
<maven.compiler.target>1.8</maven.compiler.target>
277+
<!-- Fix to build on JDK 7: version 4.0.0 requires Java 8. -->
278+
<!-- Can be dropped when CP 49 is released -->
279+
<commons.felix.version>3.5.1</commons.felix.version>
277280
<commons.componentid>codec</commons.componentid>
278281
<commons.module.name>org.apache.commons.codec</commons.module.name>
279282
<commons.jira.id>CODEC</commons.jira.id>

src/test/java/org/apache/commons/codec/StringEncoderAbstractTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121

2222
import org.junit.Assert;
2323
import org.junit.Test;
24+
import org.junit.jupiter.api.function.Executable;
25+
26+
import static org.hamcrest.MatcherAssert.assertThat;
27+
import static org.hamcrest.core.Is.is;
28+
import static org.hamcrest.core.IsEqual.equalTo;
29+
import static org.junit.jupiter.api.Assertions.assertThrows;
2430

2531
/**
2632
*/
@@ -59,13 +65,9 @@ public void testEncodeEmpty() throws Exception {
5965
}
6066

6167
@Test
62-
public void testEncodeNull() throws Exception {
68+
public void testEncodeNull() throws EncoderException {
6369
final StringEncoder encoder = this.getStringEncoder();
64-
try {
65-
encoder.encode(null);
66-
} catch (final EncoderException ee) {
67-
// An exception should be thrown
68-
}
70+
encoder.encode(null);
6971
}
7072

7173
@Test

0 commit comments

Comments
 (0)