use of com.github.bordertech.wcomponents.util.mock.servlet.MockHttpServletRequest in project wcomponents by BorderTech.
the class PlainLauncher_Test method testGetUINonWApplication.
@Test
public void testGetUINonWApplication() {
Config.getInstance().setProperty(ConfigurationProperties.LDE_PLAINLAUNCHER_COMPONENT_TO_LAUNCH, MyTestComponent.class.getName());
PlainLauncher plain = new PlainLauncher();
WComponent ui1 = plain.getUI(new MockHttpServletRequest());
Assert.assertTrue("Root UI should be a WApplication", ui1 instanceof WApplication);
ui1 = ((WApplication) ui1).getChildAt(0);
Assert.assertTrue("UI should be an instance of MyTestComponent", ui1 instanceof MyTestComponent);
// Call getUI again, the same instance should be returned
WComponent ui2 = ((WApplication) plain.getUI(new MockHttpServletRequest())).getChildAt(0);
Assert.assertSame("Should have returned the same UI instance", ui1, ui2);
}
Aggregations