@Test public void testEliminate() throws ServletException, NamespaceException { Object resource = new Object(); Set<Object> list = new HashSet<Object>(); list.add(resource); when(rootApplication.getResources()).thenReturn(list); jerseyContext.addResource(resource); List<Object> resources = jerseyContext.eliminate(); verify(rootApplication).addResource(resource); verify(httpService).unregister("/test"); assertEquals(1, resources.size()); assertEquals(resource, resources.get(0)); }