### Question:
RoleResource { @RobeService(group = "Permission", description = "Returns all services and menus collection with the matches given Role id.") @GET @Path("{id}/permissions") @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL) public Map<String, Object> getRolePermissions(@RobeAuth Credentials credentials, @PathParam("id") String id) { List<Permission> permissions = new ArrayList<>(); List<Service> services = new ArrayList<>(); List<Menu> menus = new ArrayList<>(); Role role = roleDao.findById(id); getAllRolePermissions(role, permissions); for (Permission permission : permissions) { if (permission.getType().equals(PermissionEntry.Type.SERVICE)) { Service service = serviceDao.findById(permission.getRestrictedItemOid()); if (service != null) { if (services.indexOf(service) == -1) { services.add(service); } } } else if (permission.getType().equals(PermissionEntry.Type.MENU)) { Menu menu = menuDao.findById(permission.getRestrictedItemOid()); if (menu != null) { if (menus.indexOf(menu) == -1) { menus.add(menu); } } } } Map<String, Object> response = new HashMap<>(); response.put("menu", menus); response.put("service", services); return response; }  @RobeService(group = "Permission", description = "Returns all services and menus collection with the matches given Role id.") @GET @Path("{id}/permissions") @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL) Map<String, Object> getRolePermissions(@RobeAuth Credentials credentials, @PathParam("id") String id); @RobeService(group = "Role", description = "Returns all Role as a collection.") @GET @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL) List<Role> getAll(@RobeAuth Credentials credentials, @SearchParam SearchModel search); @RobeService(group = "Role", description = "Returns a Role resource with the matches given id.") @Path("{id}") @GET @UnitOfWork(readOnly = true, cacheMode = GET, flushMode = FlushMode.MANUAL) Role get(@RobeAuth Credentials credentials, @PathParam("id") String id); @RobeService(group = "Role", description = "Create a Role resource.") @POST @UnitOfWork Role create(@RobeAuth Credentials credentials, @Valid Role model); @RobeService(group = "Role", description = "Update a Role resource with the matches given id.") @Path("{id}") @PUT @UnitOfWork Role update(@RobeAuth Credentials credentials, @PathParam("id") String id, @Valid Role model); @RobeService(group = "Role", description = "Update a Role resource with the matches given id.") @Path("{id}") @PATCH @UnitOfWork Role merge(@RobeAuth Credentials credentials, @PathParam("id") String id, Role model); @RobeService(group = "Role", description = "Delete a Role resource with the matches given id.") @Path("{id}") @DELETE @UnitOfWork Role delete(@RobeAuth Credentials credentials, @PathParam("id") String id, @Valid Role model);  }### Answer:
@Test public void getRolePermissions() throws IOException { SessionFactory sessionFactory = RobeHibernateBundle.getInstance().getSessionFactory(); ManagedSessionContext.bind(sessionFactory.openSession()); RoleDao roleDao = new RoleDao(sessionFactory); Role role = roleDao.findByCode("all"); Assert.assertTrue(role != null); TestRequest request = getRequestBuilder().endpoint(role.getId() + "/permissions").build(); TestResponse response = client.get(request); Map result = response.get(Map.class); Assert.assertTrue(result.get("menu") != null); Assert.assertTrue(result.get("service") != null); ManagedSessionContext.unbind(sessionFactory); }