@Test(expected = CyclicDependencyException.class) public void testEnter() { final CallStack callStack = new CallStack(); callStack.enter(resource1); callStack.enter(resource2); callStack.enter(resource2); }
public void enter(final Resource resource) { if (stack.contains(resource)) { throw new CyclicDependencyException(resource.toString() + " duplicated in " + this); } stack.push(resource); }
CallStack { public void enter(final Resource resource) { if (stack.contains(resource)) { throw new CyclicDependencyException(resource.toString() + " duplicated in " + this); } stack.push(resource); } }
CallStack { public void enter(final Resource resource) { if (stack.contains(resource)) { throw new CyclicDependencyException(resource.toString() + " duplicated in " + this); } stack.push(resource); }  }
CallStack { public void enter(final Resource resource) { if (stack.contains(resource)) { throw new CyclicDependencyException(resource.toString() + " duplicated in " + this); } stack.push(resource); }  void enter(final Resource resource); void exit(final Resource resource); @Override String toString(); }
CallStack { public void enter(final Resource resource) { if (stack.contains(resource)) { throw new CyclicDependencyException(resource.toString() + " duplicated in " + this); } stack.push(resource); }  void enter(final Resource resource); void exit(final Resource resource); @Override String toString();  }