use of com.github.bordertech.wcomponents.util.SystemException in project wcomponents by BorderTech.
the class UIRegistryAmicableImpl_Test method testRegisterFail.
/**
* Test register - exception on register with key already in use.
*/
@Test
public void testRegisterFail() {
final String key = "test123";
WComponent component = new DefaultWComponent();
UIRegistryAmicableImpl reg = new UIRegistryAmicableImpl();
reg.register(key, component);
try {
reg.register(key, component);
Assert.fail("attempted registration with key already used should have thrown an exception");
} catch (SystemException e) {
String expectedMessage = "Cannot re-register a component. Key = " + key;
Assert.assertEquals("exceptions hould have contained message expected", expectedMessage, e.getMessage());
}
}
Aggregations