HeliumRestApi { @GET @Path("package/{packageName}") public Response getSinglePackageInfo(@PathParam("packageName") String packageName) { if (StringUtils.isEmpty(packageName)) { return new JsonResponse(Response.Status.BAD_REQUEST, "Can't get package info for empty name").build(); } try { return new JsonResponse<>( Response.Status.OK, "", helium.getSinglePackageInfo(packageName)).build(); } catch (RuntimeException e) { logger.error(e.getMessage(), e); return new JsonResponse(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage()).build(); } } @Inject  HeliumRestApi(Helium helium, Notebook notebook); @GET @Path("package") Response getAllPackageInfo(); @GET @Path("enabledPackage") Response getAllEnabledPackageInfo(); @GET @Path("package/{packageName}") Response getSinglePackageInfo(@PathParam("packageName") String packageName); @GET @Path("suggest/{noteId}/{paragraphId}") Response suggest(@PathParam("noteId") String noteId,
          @PathParam("paragraphId") String paragraphId); @POST @Path("load/{noteId}/{paragraphId}") Response load(@PathParam("noteId") String noteId,
          @PathParam("paragraphId") String paragraphId, String heliumPackage); @GET @Path("bundle/load/{packageName}") @Produces("text/javascript") Response bundleLoad(@QueryParam("refresh") String refresh,
          @PathParam("packageName") String packageName); @POST @Path("enable/{packageName}") Response enablePackage(@PathParam("packageName") String packageName, String artifact); @POST @Path("disable/{packageName}") Response disablePackage(@PathParam("packageName") String packageName); @GET @Path("spell/config/{packageName}") Response getSpellConfigUsingMagic(@PathParam("packageName") String packageName); @GET @Path("config") Response getAllPackageConfigs(); @GET @Path("config/{packageName}/{artifact}") Response getPackageConfig(@PathParam("packageName") String packageName,
          @PathParam("artifact") String artifact); @POST @Path("config/{packageName}/{artifact}") Response updatePackageConfig(@PathParam("packageName") String packageName,
          @PathParam("artifact") String artifact, String rawConfig); @GET @Path("order/visualization") Response getVisualizationPackageOrder(); @POST @Path("order/visualization") Response setVisualizationPackageOrder(String orderedPackageNameList);  }
@Test public void testGetSinglePackageInfo() throws IOException { String packageName = "name1"; GetMethod get = httpGet("/helium/package/" + packageName); assertThat(get, isAllowed()); Map<String, Object> resp = gson.fromJson(get.getResponseBodyAsString(), new TypeToken<Map<String, Object>>() { }.getType()); List<StringMap<Object>> body = (List<StringMap<Object>>) resp.get("body"); assertEquals(body.size(), 1); StringMap<Object> pkg = (StringMap<Object>) body.get(0).get("pkg"); assertEquals(pkg.get("name"), "name1"); }