RuntimeNavigationBuilder { public NavTree build(Optional<String> navTreeJson, List<LayoutTemplate> layoutTemplates) { if (navTreeJson.isPresent()) { NavTree navTree = NavTreeJSONMarshaller.get().fromJson(navTreeJson.get()); return buildRuntimeTree(navTree, layoutTemplates); } return navTreeForTemplates(layoutTemplates); }  NavTree build(Optional<String> navTreeJson, List<LayoutTemplate> layoutTemplates);  }
@Test public void treeForEmptyNavigationTest() { LayoutTemplate lt1 = new LayoutTemplate("lt1"); LayoutTemplate lt2 = new LayoutTemplate("lt2"); LayoutTemplate lt3 = new LayoutTemplate("lt3"); List<LayoutTemplate> templates = Arrays.asList(lt1, lt2, lt3); NavTree runtimeTree = runtimeNavigationBuilder.build(Optional.empty(), templates); NavGroup orphanItemsGroup = (NavGroup) runtimeTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID); assertNotNull(orphanItemsGroup); assertEquals(3, orphanItemsGroup.getChildren().size()); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt1)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt2)); assertTrue(containsLayoutTemplate(orphanItemsGroup, lt3)); }