DataExchangeResource extends AbstractDocumentDataResource<ExchangeDocument> { @POST public Response update(@Context UriInfo uriInfo, ExchangeDocument request) { return super.update(uriInfo, request); } DataExchangeResource();  DataExchangeResource(final DataExchangeMasterResource exchangesResource, final ObjectId exchangeId); DataExchangeMasterResource getExchangesResource(); ObjectId getUrlId(); ExchangeMaster getMaster(); @GET @Path("versions") Response history(@Context UriInfo uriInfo); @GET Response get(@QueryParam("versionAsOf") String versionAsOf, @QueryParam("correctedTo") String correctedTo); @POST Response update(@Context UriInfo uriInfo, ExchangeDocument request); @DELETE void remove(); @GET @Path("versions/{versionId}") Response getVersioned(@PathParam("versionId") String versionId); @PUT @Path("versions/{versionId}") Response replaceVersion(@PathParam("versionId") String versionId, List<ExchangeDocument> replacementDocuments); @PUT Response replaceVersions(List<ExchangeDocument> replacementDocuments); @PUT @Path("all") Response replaceAllVersions(List<ExchangeDocument> replacementDocuments);  }
@Test public void testUpdateExchange() { final ManageableExchange target = new ManageableExchange(ExternalIdBundle.of("A", "B"), "Test", ExternalIdBundle.EMPTY, ZoneId.of("Europe/London")); final ExchangeDocument request = new ExchangeDocument(target); request.setUniqueId(OID.atLatestVersion()); final ExchangeDocument result = new ExchangeDocument(target); result.setUniqueId(OID.atVersion("1")); when(_underlying.update(same(request))).thenReturn(result); Response test = _resource.update(_uriInfo, request); assertEquals(Status.CREATED.getStatusCode(), test.getStatus()); assertSame(result, test.getEntity()); }