public void assertInitOptionSuccess(Option option) { try { option.validate(); } catch (InvalidOptionException e) { throw new AssertionError("Initialization failed: " + e.getMessage()); } }
public void assertInitOptionFailed(Option option, String expectedErrorMessage) { try { option.validate(); throw new AssertionError("Initialization should be failed"); } catch (InvalidOptionException e) { if (expectedErrorMessage != null) { assertEquals( expectedErrorMessage, e.getMessage().substring(0, expectedErrorMessage.length())); } } }