diff -r 620abed5f286 openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java --- a/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java Mon Oct 20 15:12:04 2008 +0200 +++ b/openide.nodes/test/unit/src/org/openide/nodes/ChildrenKeysTest.java Mon Oct 20 17:55:09 2008 +0200 @@ -254,6 +254,30 @@ assertSame("First node the same", now[0].getName(), after[0].getName()); assertSame("Last node the same", now[2].getName(), after[1].getName()); + } + + public void testGetNodesOptimal() throws Exception { + class KOpt extends Keys { + KOpt() { + super(lazy()); + } + int cnt; + @Override + public Node[] getNodes(boolean optimal) { + assertTrue("Only calling with true", optimal); + cnt++; + return super.getNodes(optimal); + } + } + + KOpt k = new KOpt(); + k.keys("1", "2", "3"); + Node n = createNode(k); + + Node[] arr = n.getChildren().getNodes(true); + assertEquals("3 nodes", 3, arr.length); + assertEquals("Calling cnt once", 1, k.cnt); + } public void testRefreshOnFavoritesAdding() throws Exception {