### Question:
ViewExternalSubResourceService extends BaseService { public void addResourceService(String resourceName, Object service) { resourceServiceMap.put(resourceName, service); } ViewExternalSubResourceService(Resource.Type type, ViewInstanceEntity viewInstanceDefinition); @GET @ApiIgnore // until documented @Produces("text/plain") Response getResources(String body, @Context HttpHeaders headers, @Context UriInfo ui); @Path("{resourceName}") Object getResource(@PathParam("resourceName") String resourceName); void addResourceService(String resourceName, Object service);  }### Answer:
@Test public void testAddResourceService() throws Exception { Resource.Type type = new Resource.Type("resource"); ViewInstanceEntity definition = ViewInstanceEntityTest.getViewInstanceEntity(); ViewExternalSubResourceService service = new ViewExternalSubResourceService(type, definition); Object fooService = new Object(); service.addResourceService("foo", fooService); Assert.assertEquals(fooService, service.getResource("foo")); try { service.getResource("bar"); Assert.fail("Expected IllegalArgumentException for unknown service name."); } catch (IllegalArgumentException e) { } }