NavTilesWidget extends BaseNavWidget { public void openItem(NavItem navItem) { NavItem parent = navItem.getParent(); if (navItemStack.isEmpty()) { if (parent != null) { navItemStack.add(parent); navItemStack.add(navItem); } } else { navItemStack.add(navItem); } this.updateBreadcrumb(); if (navItem instanceof NavGroup) { this.show((NavGroup) navItem, false); } else { NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem); String resourceId = navCtx.getResourceId(); if (resourceId != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) { if (perspectivePluginManager.isRuntimePerspective(resourceId)) { openPerspective(navItem); } else { placeManager.goTo(resourceId); } } } } @Inject  NavTilesWidget(View view,
                          NavigationManager navigationManager,
                          PerspectivePluginManager perspectivePluginManager,
                          PlaceManager placeManager,
                          SyncBeanManager beanManager); Stack<NavItem> getNavItemStack(); @Override void show(NavGroup navGroup); @Override void show(List<NavItem> itemList); void show(NavGroup navGroup, boolean clearBreadcrumb); void openItem(NavItem navItem); void onInfiniteRecursion(LayoutRecursionIssue issue); void gotoBreadcrumbItem(NavItem navItem);  }
@Test public void testOpenItem() { NavItem navItem = tree.getItemById("A"); presenter.openItem(navItem); assertEquals(presenter.getNavItemStack().size(), 2); verify(view, times(3)).addTileWidget(tileWidget); verify(view).clearBreadcrumb(); verify(view).addBreadcrumbItem(eq("Home"), any()); verify(view).addBreadcrumbItem(eq("A")); reset(view); navItem = tree.getItemById("A3"); presenter.openItem(navItem); assertEquals(presenter.getNavItemStack().size(), 3); verify(view, times(1)).addTileWidget(tileWidget); verify(view).clearBreadcrumb(); verify(view).addBreadcrumbItem(eq("Home"), any()); verify(view).addBreadcrumbItem(eq("A"), any()); verify(view).addBreadcrumbItem(eq("A3")); }