FormatReference pane =
new FormatReference("test-pane",
NDimensionalIndex.ZERO_DIMENSIONS);
// Build a one level menu
MenuEntityCreation entities = new MenuEntityCreation();
ConcreteMenu menu =
new ConcreteMenu(entities.createTestElementDetails());
menu.setTitle("Top Level Menu");
menu.setPane(pane);
boolean result = false;
try {
PrivateAccessor.setField(builder, "menu", menu);
// Test success
Boolean objectResult =
(Boolean) PrivateAccessor.invoke(builder,
"checkNestedPanes",
new Class[] {
FormatReference.class
},
new Object[] {pane});
result = objectResult.booleanValue();
} catch (Throwable t) {
fail("Test infrastructure failed (1)");
}
assertTrue("Should have returned true for the check", result);
// Build a two level menu
ConcreteMenu menuTwo =
new ConcreteMenu(entities.createTestElementDetails());
menuTwo.setTitle("Sub Menu");
menuTwo.setPane(pane);
menu.add(menuTwo);
try {
PrivateAccessor.setField(builder, "menu", menuTwo);