Search in sources :

Example 1 with Stat

use of com.github.bordertech.wcomponents.monitor.UicStats.Stat in project wcomponents by BorderTech.

the class UicStats_Test method testGetWCTreeStats.

/**
 * Test getWCTreeStats.
 */
@Test
public void testGetWCTreeStats() {
    stats.analyseWC(app);
    Map<WComponent, Stat> resultStats = stats.getWCTreeStats(app);
    // label
    for (Map.Entry<WComponent, Stat> entry : resultStats.entrySet()) {
        WComponent comp = entry.getKey();
        Stat stat = entry.getValue();
        if (comp instanceof WLabel) {
            Assert.assertEquals("this should be the label created", label, comp);
            Assert.assertEquals("stat should have correct label name", label.getId(), stat.getName());
        } else if (comp instanceof WButton) {
            Assert.assertEquals("this should be the button in the app", button, comp);
            Assert.assertEquals("stat should have correct button name", button.getId(), stat.getName());
        } else if (comp instanceof WApplication) {
            Assert.assertEquals("this should be the app", app, comp);
            Assert.assertEquals("stat should have correct app name", app.getId(), stat.getName());
        }
    }
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) Stat(com.github.bordertech.wcomponents.monitor.UicStats.Stat) WApplication(com.github.bordertech.wcomponents.WApplication) WButton(com.github.bordertech.wcomponents.WButton) Map(java.util.Map) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Aggregations

WApplication (com.github.bordertech.wcomponents.WApplication)1 WButton (com.github.bordertech.wcomponents.WButton)1 WComponent (com.github.bordertech.wcomponents.WComponent)1 WLabel (com.github.bordertech.wcomponents.WLabel)1 Stat (com.github.bordertech.wcomponents.monitor.UicStats.Stat)1 Map (java.util.Map)1 Test (org.junit.Test)1