### Question:
SmsRouteTree implements RequestHandler { @Override public Promise<ActionResponse, ResourceException> handleAction(Context context, ActionRequest request) { String remainingUri = context.asContext(UriRouterContext.class).getRemainingUri(); String action = request.getAction(); boolean forUI = Boolean.parseBoolean(request.getAdditionalParameter(FOR_UI)); if (NEXT_DESCENDENTS.equals(action) && remainingUri.isEmpty()) { JsonValue result = json(object(field("result", array()))); for (Map.Entry<String, RequestHandler> subRoute : handlers.entrySet()) { if (!subRoute.getKey().equals("")) { final ResourcePath subPath = resourcePath(subRoute.getKey()); try { readInstances(context, result.get("result"), subPath, subRoute.getValue()); } catch (ResourceException e) { return e.asPromise(); } } } return newActionResponse(result).asPromise(); } else if (GET_ALL_TYPES.equals(action) && remainingUri.isEmpty()) { try { return readTypes(context, ALL_CHILD_TYPES, false); } catch (ResourceException e) { return e.asPromise(); } } else if (GET_CREATABLE_TYPES.equals(action) && remainingUri.isEmpty()) { try { return readTypes(context, NOT_CREATED_SINGLETONS, forUI); } catch (ResourceException e) { return e.asPromise(); } } else { return router.handleAction(context, request); } } SmsRouteTree(Map<MatchingResourcePath, CrestAuthorizationModule> authzModules,
            CrestAuthorizationModule defaultAuthzModule, boolean isRoot, Router router, Filter filter,
            ResourcePath path, Predicate<String> handlesFunction, String uriTemplate); SmsRouteTree handles(String serviceName); final Route addRoute(RoutingMode mode, String uriTemplate, RequestHandler handler, boolean hideFromUi); final Route addRoute(RoutingMode mode, String uriTemplate, RequestHandler handler); final boolean removeRoute(RouteMatcher<Request> route); @Override Promise<ActionResponse, ResourceException> handleAction(Context context, ActionRequest request); @Override Promise<ResourceResponse, ResourceException> handleCreate(Context context, CreateRequest request); @Override Promise<ResourceResponse, ResourceException> handleDelete(Context context, DeleteRequest request); @Override Promise<ResourceResponse, ResourceException> handlePatch(Context context, PatchRequest request); @Override Promise<QueryResponse, ResourceException> handleQuery(Context context, QueryRequest request,
            QueryResourceHandler handler); @Override Promise<ResourceResponse, ResourceException> handleRead(Context context, ReadRequest request); @Override Promise<ResourceResponse, ResourceException> handleUpdate(Context context, UpdateRequest request);  }### Answer:
@Test public void shouldFindAllTypes() throws Exception { RequestHandler handler1 = createTypeHandler(1, "one", false); RequestHandler handler2 = createTypeHandler(2, "two", false); RequestHandler handler3 = createTypeHandler(3, "three", true); Context context = new UriRouterContext(mock(Context.class), "", "", Collections.<String, String>emptyMap()); ActionRequest request = Requests.newActionRequest("", "getAllTypes"); Promise<AuthorizationResult, ResourceException> successResult = newResultPromise(accessPermitted()); given(defaultAuthModule.authorizeAction(any(Context.class), any(ActionRequest.class))).willReturn(successResult); Promise<ActionResponse, ResourceException> result = routeTree.handleAction(context, request); AssertJPromiseAssert.assertThat(result).succeeded(); assertThat(result.getOrThrow().getJsonContent()).hasArray("result").hasSize(3).containsOnly( object(field("_id", "service1"), field("name", "one"), field("collection", false)), object(field("_id", "service2"), field("name", "two"), field("collection", false)), object(field("_id", "service3"), field("name", "three"), field("collection", true)) ); verifyGetTypeAction(handler1); verifyGetTypeAction(handler2); verifyGetTypeAction(handler3); }