garydgregory commented on a change in pull request #42:
URL: https://github.com/apache/commons-codec/pull/42#discussion_r809165283



##########
File path: 
src/test/java/org/apache/commons/codec/binary/Base32InputStreamTest.java
##########
@@ -421,11 +426,10 @@ public void testRead0() throws Exception {
     public void testReadNull() throws Exception {
         final byte[] decoded = 
StringUtils.getBytesUtf8(Base32TestData.STRING_FIXTURE);
         final ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
-        try (final Base32InputStream in = new Base32InputStream(bin, true, 4, 
new byte[] { 0, 0, 0 })) {
-            in.read(null, 0, 0);
-            fail("Base32InputStream.read(null, 0, 0) to throw a 
NullPointerException");
-        } catch (final NullPointerException e) {
-            // Expected
+        try (final Base32InputStream in = new Base32InputStream(bin, true, 4, 
new byte[]{0, 0, 0})) {
+            final Executable testMethod = () -> in.read(null, 0, 0);
+            final NullPointerException thrown = 
assertThrows(NullPointerException.class, testMethod);
+            assertThat(thrown.getMessage(), is(equalTo("array")));

Review comment:
       Please, let's not add assertions on the contents of exception messages, 
that's a maintenance headache.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to