use of com.github.bordertech.wcomponents.WComponent in project wcomponents by BorderTech.
the class InterceptorComponent_Test method testGetName.
@Test
public void testGetName() {
WComponent backing = new WLabel();
setActiveContext(createUIContext());
InterceptorComponent interceptor = new InterceptorComponent(backing);
Assert.assertEquals("Incorrect name returned", backing.getName(), interceptor.getName());
interceptor = new InterceptorComponent(interceptor);
Assert.assertEquals("Incorrect name returned for nested interceptor", backing.getName(), interceptor.getName());
}
use of com.github.bordertech.wcomponents.WComponent in project wcomponents by BorderTech.
the class InterceptorComponent_Test method testGetUI.
@Test
public void testGetUI() {
WComponent backing = new WLabel();
InterceptorComponent interceptor = new InterceptorComponent(backing);
Assert.assertSame("Incorrect backing component returned", backing, interceptor.getUI());
// Test nested interceptors
interceptor = new InterceptorComponent(interceptor);
Assert.assertSame("Incorrect backing component returned", backing, interceptor.getUI());
}
use of com.github.bordertech.wcomponents.WComponent in project wcomponents by BorderTech.
the class UicStats_Test method testGetWCsAnalysedForSpecificApp.
/**
* Test getWCsAnalysed - when one has been analysed.
*/
@Test
public void testGetWCsAnalysedForSpecificApp() {
stats.analyseWC(app);
int expectedLoopCount = 1;
int loopCount = 0;
for (Iterator<WComponent> resultWcs = stats.getWCsAnalysed(); resultWcs.hasNext(); loopCount++) {
WComponent resultComponent = resultWcs.next();
Assert.assertEquals("the analysed component should be app", app, resultComponent);
}
Assert.assertEquals("there should be only one analysed components", expectedLoopCount, loopCount);
}
use of com.github.bordertech.wcomponents.WComponent in project wcomponents by BorderTech.
the class UicStats_Test method testGetWCsAnalysedForAllRoots.
/**
* Test getWCsAnalysed - when all rootWcs have been analysed.
*/
@Test
public void testGetWCsAnalysedForAllRoots() {
stats.analyseAllRootWCs();
int expectedLoopCount = 1;
int loopCount = 0;
for (Iterator<WComponent> resultWcs = stats.getWCsAnalysed(); resultWcs.hasNext(); loopCount++) {
WComponent resultComponent = resultWcs.next();
Assert.assertEquals("the analysed component should be app", app, resultComponent);
}
Assert.assertEquals("there should be only one analysed components", expectedLoopCount, loopCount);
}
use of com.github.bordertech.wcomponents.WComponent 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