### Question:
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);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testWalkNullApplication() { WadlHandler mockHandler = mock(WadlHandler.class); WadlWalker ww = new WadlWalker(mockHandler); ww.walk(null); }
@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); }