Search in sources :

Example 51 with RequestRequestBuilder

use of org.folio.rest.support.builders.RequestRequestBuilder in project mod-circulation-storage by folio-org.

the class RequestsApiTest method createFailRequestsByUserProxyId.

@Test
public void createFailRequestsByUserProxyId() throws MalformedURLException, InterruptedException, ExecutionException, TimeoutException {
    UUID requestId = UUID.randomUUID();
    JsonObject j1 = new RequestRequestBuilder().withId(requestId).create();
    j1.put("proxyUserId", "12345");
    CompletableFuture<JsonResponse> createCompleted = new CompletableFuture<>();
    client.post(requestStorageUrl(), j1, TENANT_ID, ResponseHandler.json(createCompleted));
    JsonResponse postResponse = createCompleted.get(5, TimeUnit.SECONDS);
    assertThat(String.format("Failed to create request: %s", postResponse.getBody()), postResponse.getStatusCode(), is(422));
}
Also used : RequestRequestBuilder(org.folio.rest.support.builders.RequestRequestBuilder) CompletableFuture(java.util.concurrent.CompletableFuture) JsonObject(io.vertx.core.json.JsonObject) UUID(java.util.UUID) JsonResponse(org.folio.rest.support.JsonResponse) Test(org.junit.Test)

Aggregations

RequestRequestBuilder (org.folio.rest.support.builders.RequestRequestBuilder)51 JsonObject (io.vertx.core.json.JsonObject)50 Test (org.junit.Test)49 UUID (java.util.UUID)37 CompletableFuture (java.util.concurrent.CompletableFuture)28 JsonResponse (org.folio.rest.support.JsonResponse)23 DateTime (org.joda.time.DateTime)23 Parameters (junitparams.Parameters)9 TextResponse (org.folio.rest.support.TextResponse)9 IndividualResource (org.folio.rest.support.IndividualResource)5 Response (org.folio.rest.support.Response)5 RequestItemSummary (org.folio.rest.support.builders.RequestItemSummary)5 JsonArray (io.vertx.core.json.JsonArray)4 MockServer (org.folio.support.MockServer)4 Tags (org.folio.rest.jaxrs.model.Tags)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 HttpURLConnection (java.net.HttpURLConnection)2 HTTP_CREATED (java.net.HttpURLConnection.HTTP_CREATED)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2