@Test public void testWalk() { WadlHandler wadlHandler = mock(WadlHandler.class); WadlWalker ww = new WadlWalker(wadlHandler); List<Resource> emptyResourcesList = new ArrayList<Resource>(0); Resources mockResources = mock(Resources.class); when(mockResources.getResources()).thenReturn(emptyResourcesList); Application mockApplication = mock(Application.class); when(mockApplication.getResources()).thenReturn(mockResources); ww.walk(mockApplication); verify(wadlHandler).beginApplication(mockApplication); verify(wadlHandler).endApplication(mockApplication); }
public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource resource : resources.getResources()) { walkResource(resource, resources, application, ancestors); } } finally { handler.endApplication(application); } }
WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource resource : resources.getResources()) { walkResource(resource, resources, application, ancestors); } } finally { handler.endApplication(application); } } }
WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource resource : resources.getResources()) { walkResource(resource, resources, application, ancestors); } } finally { handler.endApplication(application); } } WadlWalker(final WadlHandler handler); }
WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource resource : resources.getResources()) { walkResource(resource, resources, application, ancestors); } } finally { handler.endApplication(application); } } WadlWalker(final WadlHandler handler); void walk(final Application application); }
WadlWalker { public void walk(final Application application) { if (application == null) { throw new IllegalArgumentException("application"); } handler.beginApplication(application); try { final Resources resources = application.getResources(); final Stack<Resource> ancestors = new Stack<Resource>(); for (final Resource resource : resources.getResources()) { walkResource(resource, resources, application, ancestors); } } finally { handler.endApplication(application); } } WadlWalker(final WadlHandler handler); void walk(final Application application);  }