You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/10/15 14:07:32 UTC

[GitHub] [commons-validator] garydgregory commented on a change in pull request #45: WIP DO NOT MERGE YET JUnit assertThrows

garydgregory commented on a change in pull request #45:
URL: https://github.com/apache/commons-validator/pull/45#discussion_r505572171



##########
File path: src/test/java/org/apache/commons/validator/routines/DomainValidatorStartupTest.java
##########
@@ -35,24 +39,52 @@
 @RunWith( ClassLoaderPerTestRunner.class )
 public class DomainValidatorStartupTest {
 
-    @Test(expected = IllegalArgumentException.class)
+    @Test
     public void testUpdateBaseArrayCC() {
-        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"});
+        // FIXME Simplification once upgraded to Java 1.8
+        final ThrowingRunnable testMethod = new ThrowingRunnable() {
+            public void run() {
+                DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"});
+            }
+        };
+        final IllegalArgumentException thrown = assertThrows(IllegalArgumentException.class, testMethod);
+        assertThat(thrown.getMessage(), is(equalTo("Cannot update the table: COUNTRY_CODE_RO")));

Review comment:
       Same comment as in the Apache Commons Collections PR. Let's skip asserting the exception messages.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org