Search in sources :

Example 16 with DefaultWComponent

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));
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) Test(org.junit.Test)

Example 17 with DefaultWComponent

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));
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) Test(org.junit.Test)

Example 18 with DefaultWComponent

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));
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) Test(org.junit.Test)

Example 19 with DefaultWComponent

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));
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) Test(org.junit.Test)

Aggregations

DefaultWComponent (com.github.bordertech.wcomponents.DefaultWComponent)19 Test (org.junit.Test)19 WComponent (com.github.bordertech.wcomponents.WComponent)8 UIContext (com.github.bordertech.wcomponents.UIContext)7 WText (com.github.bordertech.wcomponents.WText)6 AjaxOperation (com.github.bordertech.wcomponents.AjaxOperation)4 TestLookupTable (com.github.bordertech.wcomponents.TestLookupTable)2 WFigure (com.github.bordertech.wcomponents.WFigure)2 WPanel (com.github.bordertech.wcomponents.WPanel)2 WSection (com.github.bordertech.wcomponents.WSection)2 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)2 SystemException (com.github.bordertech.wcomponents.util.SystemException)2 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)2 MockResponse (com.github.bordertech.wcomponents.util.mock.MockResponse)2 PrintWriter (java.io.PrintWriter)2 List (java.util.List)2 Action (com.github.bordertech.wcomponents.Action)1 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)1 WInternalLink (com.github.bordertech.wcomponents.WInternalLink)1 WSuggestions (com.github.bordertech.wcomponents.WSuggestions)1