@Test public void nodePathScope() { NodeState nodeState = new NodeState("label", "icon", -1, -1, Visibility.DISPLAYED, new PageKey(new SiteKey(SiteType.PORTAL, "site"), "page"), false, AttributesState.EMPTY); NodeVisitorMock mock = new NodeVisitorMock(); Visitor visitor = new NodeVisitorScope(mock).get(); mock.instrument(true); assertEquals(VisitMode.ALL_CHILDREN, visitor.enter(0, "id", "default", nodeState)); assertNull(mock.name); assertNull(mock.details); mock.instrument(true); assertEquals(VisitMode.ALL_CHILDREN, visitor.enter(1, "id", "1", nodeState)); assertNotNull(mock.name); assertEquals(1, mock.depth); assertEquals(NodePath.path("1"), mock.details.getNodePath()); mock.instrument(false); assertEquals(VisitMode.NO_CHILDREN, visitor.enter(2, "id", "1-1", nodeState)); assertNotNull(mock.name); assertEquals(2, mock.depth); assertEquals(NodePath.path("1", "1-1"), mock.details.getNodePath()); visitor.leave(2, "id", "1-1", nodeState); visitor.leave(1, "id", "1", nodeState); visitor.leave(0, "id", "default", null); mock.instrument(false); }
@Override public Visitor get() { return new NodeVisitorAdapter(visitor); }
NodeVisitorScope implements Scope { @Override public Visitor get() { return new NodeVisitorAdapter(visitor); } }
NodeVisitorScope implements Scope { @Override public Visitor get() { return new NodeVisitorAdapter(visitor); } NodeVisitorScope(NodeVisitor visitor); }
NodeVisitorScope implements Scope { @Override public Visitor get() { return new NodeVisitorAdapter(visitor); } NodeVisitorScope(NodeVisitor visitor); @Override Visitor get(); }
NodeVisitorScope implements Scope { @Override public Visitor get() { return new NodeVisitorAdapter(visitor); } NodeVisitorScope(NodeVisitor visitor); @Override Visitor get();  }