Github user jdanekrh commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1688#discussion_r155199713 --- Diff: tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConfigurationValidationTest.java --- @@ -57,4 +57,23 @@ public void testFullConfiguration() throws Exception { Assert.assertEquals(true, fc.isPersistDeliveryCountBeforeDelivery()); } + + @Test + public void testChangeConfiguration() throws Exception { + FileConfiguration fc = new FileConfiguration(); + FileDeploymentManager deploymentManager = new FileDeploymentManager("ConfigurationTest-full-config.xml"); + deploymentManager.addDeployable(fc); + deploymentManager.readConfiguration(); + + boolean success = false; // test should fail because config contains wrong element + + deploymentManager = new FileDeploymentManager("ConfigurationTest-full-config-wrong-address.xml"); + deploymentManager.addDeployable(fc); + try { + deploymentManager.readConfiguration(); + } catch (Exception e) { + success = true; + } + Assert.assertTrue(success); --- End diff -- Tests like that seem to be usually written a bit differently, like this https://github.com/apache/activemq-artemis/blob/f698a7f8189af7b70160ba18596be371642776bb/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/BodyTest.java#L66 It can be worth it to name the exception variable `ignored`, not `e`, because that is a hint to unused variable inspection in IntelliJ. https://www.reddit.com/r/ProgrammerHumor/comments/2so5tu/mildly_amusing_intellij_suggests_to_rename_a/ Not sure what it would suggest if you have multiple ignored exceptions in scope... It is less verbose than https://docs.oracle.com/javase/7/docs/api/java/lang/SuppressWarnings.html ("unused")
---