Source:
public void testPreferencePage() { openTraceTypePreferences(); SWTBot bot = fBot.activeShell().bot(); SWTBotTree treeBot = bot.tree(1); bot.button(CHECK_ALL).click(); Integer defaultCount = SWTBotUtils.getTreeCheckedItemCount(treeBot); bot.button(UNCHECK_ALL).click(); Integer checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(0, checked.intValue()); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(CHECK_ALL, defaultCount.intValue(), checked.intValue()); treeBot.getTreeItem("Custom XML").select(); bot.button(UNCHECK_ALL).click(); bot.button(CHECK_SELECTED).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(CHECK_SELECTED, 2, checked.intValue()); bot.button(CHECK_ALL).click(); bot.button(UNCHECK_SELECTED).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(UNCHECK_SELECTED, defaultCount.intValue() - 2, checked.intValue()); bot.button(UNCHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(0, checked.intValue()); bot.text(1).setText("Custom XML"); WaitUtils.waitUntil(tree -> tree.visibleRowCount() == 2, treeBot, "Visible row count: Default expected 2, but actual value is " + treeBot.visibleRowCount()); assertEquals("Filtered no checked", 0, checked.intValue()); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals("Filtered check all", 2, checked.intValue()); bot.text(1).setText(""); WaitUtils.waitUntil(tree -> tree.visibleRowCount() == defaultCount.intValue(), treeBot, "Visible row count: Default expected " + defaultCount.intValue() +", but actual value is " + treeBot.visibleRowCount()); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals("Filtered removed all check", defaultCount.intValue(), checked.intValue()); bot.button("Apply").click(); bot.button("OK").click(); }

Target:
public void testPreferencePage() { openTraceTypePreferences(); SWTBot bot = fBot.activeShell().bot(); SWTBotTree treeBot = bot.tree(1); bot.button(CHECK_ALL).click(); int defaultCount = SWTBotUtils.getTreeCheckedItemCount(treeBot); bot.button(UNCHECK_ALL).click(); int checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(0, checked); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(CHECK_ALL, defaultCount, checked); treeBot.getTreeItem("Custom XML").select(); bot.button(UNCHECK_ALL).click(); bot.button(CHECK_SELECTED).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(CHECK_SELECTED, 2, checked); bot.button(CHECK_ALL).click(); bot.button(UNCHECK_SELECTED).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(UNCHECK_SELECTED, defaultCount - 2, checked); bot.button(UNCHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals(0, checked); bot.text(1).setText("Custom XML"); WaitUtils.waitUntil(tree -> tree.visibleRowCount() == 2, treeBot, "Visible row count: Default expected 2, but actual value is " + treeBot.visibleRowCount()); assertEquals("Filtered no checked", 0, checked); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals("Filtered check all", 2, checked); bot.text(1).setText(""); WaitUtils.waitUntil(tree -> tree.visibleRowCount() == defaultCount, treeBot, "Visible row count: Default expected " + defaultCount +", but actual value is " + treeBot.visibleRowCount()); bot.button(CHECK_ALL).click(); checked = SWTBotUtils.getTreeCheckedItemCount(treeBot); assertEquals("Filtered removed all check", defaultCount, checked); bot.button("Apply").click(); bot.button("OK").click(); }