use of com.github.bordertech.wcomponents.DefaultWComponent in project wcomponents by BorderTech.
the class UIRegistryAmicableImpl_Test method testRegisterSuccess.
/**
* Test register - success.
*/
@Test
public void testRegisterSuccess() {
final String key = "test123";
WComponent component = new DefaultWComponent();
UIRegistryAmicableImpl reg = new UIRegistryAmicableImpl();
reg.register(key, component);
Assert.assertTrue("should have been successfully registered", reg.isRegistered(key));
}
use of com.github.bordertech.wcomponents.DefaultWComponent in project wcomponents by BorderTech.
the class UIRegistryAmicableImpl_Test method testIsRegistered.
/**
* Test isRegistered - for cases where key - exists, not exist, empty, null.
*/
@Test
public void testIsRegistered() {
final String keyExists = "test123";
final String keyNotExist = "nothingtobefound";
final String keyEmpty = "";
final String keyNull = null;
WComponent component = new DefaultWComponent();
UIRegistryAmicableImpl reg = new UIRegistryAmicableImpl();
reg.register(keyExists, component);
Assert.assertTrue("should find component", reg.isRegistered(keyExists));
Assert.assertFalse("should not find component", reg.isRegistered(keyNotExist));
Assert.assertFalse("should not find component - key empty", reg.isRegistered(keyEmpty));
Assert.assertFalse("should not find component - key null", reg.isRegistered(keyNull));
}
use of com.github.bordertech.wcomponents.DefaultWComponent in project wcomponents by BorderTech.
the class UIRegistryAmicableImpl_Test method testGetUIRegistered.
/**
* Test getUI - successfully get a component already registered.
*/
@Test
public void testGetUIRegistered() {
final String key = "test123";
WComponent component = new DefaultWComponent();
UIRegistryAmicableImpl reg = new UIRegistryAmicableImpl();
reg.register(key, component);
Assert.assertSame("should return component registered", component, reg.getUI(key));
}
use of com.github.bordertech.wcomponents.DefaultWComponent in project wcomponents by BorderTech.
the class UIRegistryClassLoaderImpl_Test method testIsRegistered.
/**
* Test isRegistered - for cases where key - exists, not exist, empty, null.
*/
@Test
public void testIsRegistered() {
final String keyExists = "test123";
final String keyNotExist = "nothingtobefound";
final String keyEmpty = "";
final String keyNull = null;
WComponent component = new DefaultWComponent();
UIRegistryClassLoaderImpl reg = new UIRegistryClassLoaderImpl();
reg.register(keyExists, component);
Assert.assertTrue("should find component", reg.isRegistered(keyExists));
Assert.assertFalse("should not find component", reg.isRegistered(keyNotExist));
Assert.assertFalse("should not find component - key empty", reg.isRegistered(keyEmpty));
Assert.assertFalse("should not find component - key null", reg.isRegistered(keyNull));
}
Aggregations