DataRegionSourceResource extends AbstractDataResource { @GET @Path("regions") public Response search( @QueryParam("versionAsOf") String versionAsOf, @QueryParam("correctedTo") String correctedTo, @QueryParam("id") List<String> externalIdStrs) { final VersionCorrection vc = VersionCorrection.parse(versionAsOf, correctedTo); final ExternalIdBundle bundle = ExternalIdBundle.parse(externalIdStrs); Collection<? extends Region> result = getRegionSource().get(bundle, vc); return responseOkObject(FudgeListWrapper.of(result)); } DataRegionSourceResource(final RegionSource regionSource); RegionSource getRegionSource(); @GET Response getHateaos(@Context UriInfo uriInfo); @GET @Path("regions") Response search(
      @QueryParam("versionAsOf") String versionAsOf,
      @QueryParam("correctedTo") String correctedTo,
      @QueryParam("id") List<String> externalIdStrs); @GET @Path("regions/{regionId}") Response get(
      @PathParam("regionId") String idStr,
      @QueryParam("version") String version,
      @QueryParam("versionAsOf") String versionAsOf,
      @QueryParam("correctedTo") String correctedTo); static URI uriSearch(URI baseUri, VersionCorrection vc, ExternalIdBundle bundle); static URI uriGet(URI baseUri, UniqueId uniqueId); static URI uriGet(URI baseUri, ObjectId objectId, VersionCorrection vc); @GET @Path("regionSearches/highest") Response searchHighest(@QueryParam("id") List<String> externalIdStrs); static URI uriSearchHighest(URI baseUri, ExternalIdBundle bundle);  }
@SuppressWarnings({"rawtypes", "unchecked" }) @Test public void testSearch() { final SimpleRegion target = new SimpleRegion(); target.setExternalIdBundle(BUNDLE); target.setName("Test"); Collection targetColl = ImmutableList.<Region>of(target); when(_underlying.get(eq(BUNDLE), eq(VC))).thenReturn(targetColl); Response test = _resource.search(VC.getVersionAsOfString(), VC.getCorrectedToString(), BUNDLE.toStringList()); assertEquals(Status.OK.getStatusCode(), test.getStatus()); assertEquals(FudgeListWrapper.of(targetColl), test.getEntity()); }