Skip to content
Permalink
Browse files

test: catch expected errors instead of all errors

  • Loading branch information...
rhwood committed May 25, 2019
1 parent 1c88c69 commit 55b5eb0a20eb5166b7eb63464c0e8f87186c43d3
Showing with 9 additions and 5 deletions.
  1. +9 −5 java/test/jmri/jmrix/can/cbus/CbusAddressTest.java
@@ -14,7 +14,7 @@
/**
* Tests for the jmri.jmrix.can.cbus.CbusAddress class.
*
* @author Bob Jacobsen Copyright 2008
* @author Bob Jacobsen Copyright 2008
*/
public class CbusAddressTest {

@@ -324,13 +324,17 @@ public void testgetIncrement() {
@Test
public void testvalidateSysName() {
try {
Assert.assertEquals("+0",null,CbusAddress.validateSysName("+0"));
} catch (Exception e) {
}
CbusAddress.validateSysName("+0");
Assert.fail("Expected exception not thrown");
} catch (IllegalArgumentException ex) {
Assert.assertEquals("Event cannot be 0 in address: +0", ex.getMessage());
}

try {
Assert.assertEquals("-0",null,CbusAddress.validateSysName("-0"));
} catch (Exception e) {
Assert.fail("Expected exception not thrown");
} catch (IllegalArgumentException ex) {
Assert.assertEquals("Event cannot be 0 in address: -0", ex.getMessage());
}

}

0 comments on commit 55b5eb0

Please sign in to comment.
You can’t perform that action at this time.