io.restassured.parsing.Parser Java Examples
The following examples show how to use
io.restassured.parsing.Parser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HealthCheckDefaultScopeTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; when().get("/health/live").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("noScope")); when().get("/health/live").then() .body("status", is("DOWN"), "checks.status", contains("DOWN"), "checks.name", contains("noScope")); } finally { RestAssured.reset(); } }
Example #2
Source File: DownloadApiIntegrationTest.java From api-layer with Eclipse Public License 2.0 | 6 votes |
@Test @TestsNotMeantForZowe public void shouldSendGetRequestAndDownloadCompressedImage() { RestAssured.registerParser("image/png", Parser.JSON); URI uri = HttpRequestUtils.getUriFromGateway("/api/v1/discoverableclient/get-file"); given(). contentType("application/octet-stream"). accept("image/png"). when(). get(uri). then(). statusCode(200). header("Content-Disposition", "attachment;filename=api-catalog.png"). header("Content-Encoding", "gzip"). contentType("image/png"); }
Example #3
Source File: LinshareBlobExportMechanismIntegrationTest.java From james-project with Apache License 2.0 | 6 votes |
@BeforeEach void setup(GuiceJamesServer jmapServer) throws Throwable { this.jmapServer = jmapServer; jmapServer.getProbe(DataProbeImpl.class) .fluent() .addDomain(DOMAIN) .addUser(HOMER, HOMER_PASSWORD) .addUser(BART, BART_PASSWORD); Port jmapPort = jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort(); RestAssured.requestSpecification = jmapRequestSpecBuilder .setPort(jmapPort.getValue()) .build(); RestAssured.defaultParser = Parser.JSON; webAdminApi = WebAdminUtils.spec(jmapServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort()); MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); mailboxProbe.createMailbox(MailboxConstants.USER_NAMESPACE, HOMER, DefaultMailboxes.INBOX); homerAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(HOMER), HOMER_PASSWORD); bartAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(BART), BART_PASSWORD); user1LinshareAPI = LinshareAPIForUserTesting.from(USER_1); }
Example #4
Source File: RabbitMQReindexingWithEventDeadLettersTest.java From james-project with Apache License 2.0 | 6 votes |
@BeforeEach void setUp(GuiceJamesServer jamesServer) throws Exception { jamesServer.getProbe(DataProbeImpl.class) .fluent() .addDomain(DOMAIN) .addUser(ALICE.asString(), ALICE_PASSWORD); Port jmapPort = jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort(); RestAssured.requestSpecification = jmapRequestSpecBuilder .setPort(jmapPort.getValue()) .build(); RestAssured.defaultParser = Parser.JSON; webAdminApi = WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort()); aliceAccessToken = authenticateJamesUser(LocalHostURIBuilder.baseUri(jmapPort), ALICE, ALICE_PASSWORD); dockerElasticSearch.getDockerES().pause(); Thread.sleep(Duration.TEN_SECONDS.getValueInMS()); // Docker pause is asynchronous and we found no way to poll for it }
Example #5
Source File: MailRepositoriesRoutesTest.java From james-project with Apache License 2.0 | 6 votes |
@Test public void downloadingAMailShouldFailWhenUnknown() throws Exception { mailRepositoryStore.create(URL_MY_REPO); RestAssured.requestSpecification = new RequestSpecBuilder().setPort(webAdminServer.getPort().getValue()) .setBasePath(MailRepositoriesRoutes.MAIL_REPOSITORIES) .build(); RestAssured.registerParser(Constants.RFC822_CONTENT_TYPE, Parser.TEXT); String name = "name"; given() .accept(Constants.RFC822_CONTENT_TYPE) .when() .get(PATH_ESCAPED_MY_REPO + "/mails/" + name) .then() .statusCode(HttpStatus.NOT_FOUND_404) .body("statusCode", is(404)) .body("type", is(ErrorResponder.ErrorType.NOT_FOUND.getType())) .body("message", is("Could not retrieve " + name)); }
Example #6
Source File: JaxRSTestCase.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testJaxbConsumption() throws Exception { TestResource.XmlObject xmlObject = new TestResource.XmlObject(); xmlObject.setValue("test"); StringWriter writer = new StringWriter(); JAXBContext context = JAXBContext.newInstance(TestResource.XmlObject.class); Marshaller m = context.createMarshaller(); m.marshal(xmlObject, writer); try { // in the native image case, the right parser is not chosen, despite the content-type being correct RestAssured.defaultParser = Parser.XML; RestAssured.given().contentType("application/xml").body(writer.toString()).when().post("/test/consumeXml").then() .body(is("test")); } finally { RestAssured.reset(); } }
Example #7
Source File: HealthCheckProducerDefaultScopeTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; when().get("/health/ready").then() .body("status", is("UP"), "checks.status", contains("UP", "UP"), "checks.name", containsInAnyOrder("alpha1", "bravo1")); when().get("/health/ready").then() .body("status", is("UP"), "checks.status", contains("UP", "UP"), "checks.name", containsInAnyOrder("alpha1", "bravo2")); } finally { RestAssured.reset(); } }
Example #8
Source File: TracingTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testCDI() { try { RestAssured.defaultParser = Parser.TEXT; RestAssured.when().get("/cdi") .then() .statusCode(200); Assertions.assertEquals(2, mockTracer.finishedSpans().size()); Assertions.assertEquals("io.quarkus.smallrye.opentracing.deployment.Service.foo", mockTracer.finishedSpans().get(0).operationName()); Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.cdi", mockTracer.finishedSpans().get(1).operationName()); } finally { RestAssured.reset(); } }
Example #9
Source File: TracingTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test public void testMPRestClient() { try { RestAssured.defaultParser = Parser.TEXT; RestAssured.when().get("/restClient") .then() .statusCode(200); Assertions.assertEquals(3, mockTracer.finishedSpans().size()); Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello", mockTracer.finishedSpans().get(0).operationName()); Assertions.assertEquals("GET", mockTracer.finishedSpans().get(1).operationName()); Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.restClient", mockTracer.finishedSpans().get(2).operationName()); } finally { RestAssured.reset(); } }
Example #10
Source File: SpamAssassinContract.java From james-project with Apache License 2.0 | 6 votes |
@BeforeEach default void setup(GuiceJamesServer jamesServer) throws Throwable { RestAssured.requestSpecification = new RequestSpecBuilder() .setContentType(ContentType.JSON) .setAccept(ContentType.JSON) .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8))) .setPort(jamesServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()) .build(); RestAssured.defaultParser = Parser.JSON; jamesServer.getProbe(DataProbeImpl.class) .fluent() .addDomain(BOBS_DOMAIN) .addDomain(RECIPIENTS_DOMAIN) .addUser(BOB, BOB_PASSWORD) .addUser(ALICE, ALICE_PASSWORD) .addUser(PAUL, PAUL_PASSWORD); }
Example #11
Source File: SetMessagesOutboxFlagUpdateTest.java From james-project with Apache License 2.0 | 6 votes |
@Before public void setup() throws Throwable { jmapServer = createJmapServer(); jmapServer.start(); MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class); RestAssured.requestSpecification = new RequestSpecBuilder() .setContentType(ContentType.JSON) .setAccept(ContentType.JSON) .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8))) .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()) .build(); RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); RestAssured.defaultParser = Parser.JSON; dataProbe.addDomain(DOMAIN); dataProbe.addUser(USERNAME.asString(), PASSWORD); dataProbe.addUser(BOB.asString(), BOB_PASSWORD); mailboxProbe.createMailbox("#private", USERNAME.asString(), DefaultMailboxes.INBOX); accessToken = HttpJmapAuthentication.authenticateJamesUser(baseUri(jmapServer), USERNAME, PASSWORD); }
Example #12
Source File: QuotaMailingTest.java From james-project with Apache License 2.0 | 6 votes |
@Before public void setup() throws Throwable { jmapServer = createJmapServer(); jmapServer.start(); MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class); quotaProbe = jmapServer.getProbe(QuotaProbesImpl.class); RestAssured.requestSpecification = jmapRequestSpecBuilder .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()) .build(); RestAssured.defaultParser = Parser.JSON; dataProbe.addDomain(DOMAIN); dataProbe.addUser(HOMER.asString(), PASSWORD); dataProbe.addUser(BART.asString(), BOB_PASSWORD); mailboxProbe.createMailbox("#private", HOMER.asString(), DefaultMailboxes.INBOX); homerAccessToken = authenticateJamesUser(baseUri(jmapServer), HOMER, PASSWORD); bartAccessToken = authenticateJamesUser(baseUri(jmapServer), BART, BOB_PASSWORD); }
Example #13
Source File: SendMDNMethodTest.java From james-project with Apache License 2.0 | 6 votes |
@BeforeEach void setup(GuiceJamesServer jmapServer) throws Throwable { this.jmapServer = jmapServer; MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class); RestAssured.requestSpecification = jmapRequestSpecBuilder .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()) .build(); RestAssured.defaultParser = Parser.JSON; dataProbe.addDomain(DOMAIN); dataProbe.addUser(HOMER.asString(), PASSWORD); dataProbe.addUser(BART.asString(), BOB_PASSWORD); mailboxProbe.createMailbox("#private", HOMER.asString(), DefaultMailboxes.INBOX); homerAccessToken = authenticateJamesUser(baseUri(jmapServer), HOMER, PASSWORD); bartAccessToken = authenticateJamesUser(baseUri(jmapServer), BART, BOB_PASSWORD); }
Example #14
Source File: SetMessagesMethodReRoutingTest.java From james-project with Apache License 2.0 | 6 votes |
@Before public void setup() throws Throwable { jmapServer = createJmapServer(); jmapServer.start(); mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); dataProbe = jmapServer.getProbe(DataProbeImpl.class); RestAssured.requestSpecification = new RequestSpecBuilder() .setContentType(ContentType.JSON) .setAccept(ContentType.JSON) .setConfig(newConfig().encoderConfig(encoderConfig().defaultContentCharset(StandardCharsets.UTF_8))) .setPort(jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort().getValue()) .build(); RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); RestAssured.defaultParser = Parser.JSON; dataProbe.addDomain(DESTINATION_DOMAIN); dataProbe.addDomain(ALIAS_DOMAIN); dataProbe.addUser(RECEIVER_AT_DESTINATION_DOMAIN, PASSWORD); dataProbe.addUser(SENDER_AT_DESTINATION_DOMAIN, PASSWORD); receiverAtDestinationDomainToken = authenticateJamesUser(baseUri(jmapServer), Username.of(RECEIVER_AT_DESTINATION_DOMAIN), PASSWORD); senderAtDestinationDomainToken = authenticateJamesUser(baseUri(jmapServer), Username.of(SENDER_AT_DESTINATION_DOMAIN), PASSWORD); }
Example #15
Source File: AppTestBase.java From microprofile-open-api with Apache License 2.0 | 5 votes |
@BeforeClass public static void configureRestAssured() throws MalformedURLException { // set base URI and port number to use for all requests serverUrl = System.getProperty("test.url"); String protocol = DEFAULT_PROTOCOL; String host = DEFAULT_HOST; int port = DEFAULT_PORT; if (serverUrl != null) { URL url = new URL(serverUrl); protocol = url.getProtocol(); host = url.getHost(); port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort(); } RestAssured.baseURI = protocol + "://" + host; RestAssured.port = port; username = System.getProperty("test.user"); password = System.getProperty("test.pwd"); if (username != null && password != null) { RestAssured.authentication = RestAssured.basic(username, password); RestAssured.useRelaxedHTTPSValidation(); } RestAssured.defaultParser = Parser.JSON; if (StringUtils.isBlank(serverUrl)) { serverUrl = DEFAULT_PROTOCOL + "://" + DEFAULT_HOST + ":" + DEFAULT_PORT; } }
Example #16
Source File: RabbitMQJamesServerReprocessingTest.java From james-project with Apache License 2.0 | 5 votes |
@BeforeEach void setUp(GuiceJamesServer server) { RestAssured.defaultParser = Parser.JSON; webAdminApi = WebAdminUtils.spec(server.getProbe(WebAdminGuiceProbe.class).getWebAdminPort()) .config(WebAdminUtils.defaultConfig() .paramConfig(new ParamConfig(REPLACE, REPLACE, REPLACE))); }
Example #17
Source File: ConfigurationExtension.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void beforeAll( ExtensionContext context ) { RestAssured.baseURI = TestConfiguration.get().baseUrl(); RestAssured.enableLoggingOfRequestAndResponseIfValidationFails(); RestAssured.defaultParser = Parser.JSON; RestAssured.requestSpecification = defaultRequestSpecification(); }
Example #18
Source File: MailRepositoriesRoutesTest.java From james-project with Apache License 2.0 | 5 votes |
@Test public void downloadingAMailShouldReturnTheEml() throws Exception { RestAssured.requestSpecification = new RequestSpecBuilder().setPort(webAdminServer.getPort().getValue()) .setBasePath(MailRepositoriesRoutes.MAIL_REPOSITORIES) .build(); RestAssured.registerParser(Constants.RFC822_CONTENT_TYPE, Parser.TEXT); MailRepository mailRepository = mailRepositoryStore.create(URL_MY_REPO); String name = NAME_1; FakeMail mail = FakeMail.builder() .name(name) .fileName("mail.eml") .build(); mailRepository.store(mail); String expectedContent = ClassLoaderUtils.getSystemResourceAsString("mail.eml", StandardCharsets.UTF_8); String actualContent = given() .accept(Constants.RFC822_CONTENT_TYPE) .when() .get(PATH_ESCAPED_MY_REPO + "/mails/" + name) .then() .statusCode(HttpStatus.OK_200) .header("Content-Length", "471") .contentType(Constants.RFC822_CONTENT_TYPE) .extract() .body() .asString(); assertThat(actualContent).isEqualToNormalizingNewlines(expectedContent); }
Example #19
Source File: DeletedMessageVaultIntegrationTest.java From james-project with Apache License 2.0 | 5 votes |
@BeforeEach void setup(GuiceJamesServer jmapServer) throws Throwable { MailboxProbe mailboxProbe = jmapServer.getProbe(MailboxProbeImpl.class); DataProbe dataProbe = jmapServer.getProbe(DataProbeImpl.class); Port jmapPort = jmapServer.getProbe(JmapGuiceProbe.class).getJmapPort(); RestAssured.requestSpecification = jmapRequestSpecBuilder .setPort(jmapPort.getValue()) .build(); RestAssured.defaultParser = Parser.JSON; dataProbe.addDomain(DOMAIN); dataProbe.addUser(HOMER, PASSWORD); dataProbe.addUser(BART, BOB_PASSWORD); dataProbe.addUser(JACK, PASSWORD); mailboxProbe.createMailbox("#private", HOMER, DefaultMailboxes.INBOX); otherMailboxId = mailboxProbe.createMailbox("#private", HOMER, MAILBOX_NAME); homerAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(HOMER), PASSWORD); bartAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(BART), BOB_PASSWORD); jackAccessToken = authenticateJamesUser(baseUri(jmapPort), Username.of(JACK), PASSWORD); testIMAPClient = new TestIMAPClient(); webAdminApi = WebAdminUtils.spec(jmapServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort()) .config(WebAdminUtils.defaultConfig() .paramConfig(new ParamConfig(REPLACE, REPLACE, REPLACE))); }
Example #20
Source File: BaseIT.java From apicurio-registry with Apache License 2.0 | 5 votes |
@BeforeAll static void beforeAll() throws Exception { if (!TestUtils.isExternalRegistry()) { registry.start(); } else { LOGGER.info("Going to use already running registries on {}", TestUtils.getRegistryUrl()); } TestUtils.waitFor("Cannot connect to registries on " + TestUtils.getRegistryUrl() + " in timeout!", Constants.POLL_INTERVAL, Constants.TIMEOUT_FOR_REGISTRY_START_UP, TestUtils::isReachable); TestUtils.waitFor("Registry reports is ready", Constants.POLL_INTERVAL, Constants.TIMEOUT_FOR_REGISTRY_READY, () -> TestUtils.isReady(false), () -> TestUtils.isReady(true)); RestAssured.baseURI = TestUtils.getRegistryUrl(); LOGGER.info("Registry app is running on {}", RestAssured.baseURI); RestAssured.defaultParser = Parser.JSON; }
Example #21
Source File: HealthUnitTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testHealth() { // the health check does not set a content type so we need to force the parser try { RestAssured.defaultParser = Parser.JSON; RestAssured.when().get("/health/live").then() .body("status", is("UP"), "checks.status", contains("UP"), "checks.name", contains("basic")); } finally { RestAssured.reset(); } }
Example #22
Source File: MappingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testStructuredAnnotatedMapping() { RestAssured.given().contentType("application/cloudevents+json") .body(echoEvent) .post("/") .then().statusCode(200) .defaultParser(Parser.JSON) .body("id", notNullValue()) .body("specversion", equalTo("1.0")) .body("type", equalTo("echo.output")) .body("source", equalTo("echo")) .body("datacontenttype", equalTo("application/json")) .body("data", equalTo("HELLO")); }
Example #23
Source File: MappingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testStructuredDefaultMapping() { RestAssured.given().contentType("application/cloudevents+json") .body(doubleItEvent) .post("/") .then().statusCode(200) .defaultParser(Parser.JSON) .body("id", notNullValue()) .body("specversion", equalTo("1.0")) .body("type", equalTo("doubleIt.output")) .body("source", equalTo("doubleIt")) .body("datacontenttype", equalTo("application/json")) .body("data", equalTo(4)); }
Example #24
Source File: MappingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testStructuredMapping() { RestAssured.given().contentType("application/cloudevents+json") .body(tolowercaseEvent) .post("/") .then().statusCode(200) .defaultParser(Parser.JSON) .body("id", notNullValue()) .body("specversion", equalTo("1.0")) .body("type", equalTo("lowercase")) .body("source", equalTo("to.lowercase")) .body("datacontenttype", equalTo("application/json")) .body("data", equalTo("hello")); }
Example #25
Source File: GreetTestBase.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testStructured() { RestAssured.given().contentType("application/cloudevents+json") .body(event) .post("/") .then().statusCode(200) .defaultParser(Parser.JSON) .body("id", notNullValue()) .body("specversion", equalTo("1.0")) .body("type", equalTo(getCeType())) .body("source", equalTo(getCeSource())) .body("datacontenttype", equalTo("application/json")) .body("data.name", equalTo("Bill")) .body("data.message", equalTo("Hello Bill!")); }
Example #26
Source File: TracingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testJPA() { try { RestAssured.defaultParser = Parser.JSON; RestAssured.when().get("/jpa") .then() .statusCode(200) .body("", hasSize(3)) .body("name[0]", equalTo("Apple")) .body("name[1]", equalTo("Banana")) .body("name[2]", equalTo("Cherry")); List<MockSpan> spans = mockTracer.finishedSpans(); Assertions.assertEquals(3, spans.size()); for (MockSpan mockSpan : spans) { Assertions.assertEquals(spans.get(0).context().traceId(), mockSpan.context().traceId()); } MockSpan firstSpan = mockTracer.finishedSpans().get(0); Assertions.assertEquals("Query", firstSpan.operationName()); Assertions.assertTrue(firstSpan.tags().containsKey("db.statement")); Assertions.assertTrue(firstSpan.tags().get("db.statement").toString().contains("known_fruits")); Assertions.assertEquals("io.quarkus.smallrye.opentracing.deployment.Service.getFruits", mockTracer.finishedSpans().get(1).operationName()); Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.jpa", mockTracer.finishedSpans().get(2).operationName()); } finally { RestAssured.reset(); } }
Example #27
Source File: TracingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testContextPropagationInFaultTolerance() { try { RestAssured.defaultParser = Parser.TEXT; RestAssured.when().get("/faultTolerance") .then() .statusCode(200) .body(equalTo("fallback")); Awaitility.await().atMost(5, TimeUnit.SECONDS) .until(() -> mockTracer.finishedSpans().size() == 5); List<MockSpan> spans = mockTracer.finishedSpans(); Assertions.assertEquals(5, spans.size()); for (MockSpan mockSpan : spans) { Assertions.assertEquals(spans.get(0).context().traceId(), mockSpan.context().traceId()); } // if timeout occurs, subsequent retries/fallback can be interleaved with the execution that timed out, // resulting in varying span order Assertions.assertEquals(3, countSpansWithOperationName(spans, "ft")); Assertions.assertEquals(1, countSpansWithOperationName(spans, "fallback")); Assertions.assertEquals(1, countSpansWithOperationName(spans, "GET:io.quarkus.smallrye.opentracing.deployment.TestResource.faultTolerance")); } finally { RestAssured.reset(); } }
Example #28
Source File: TracingTest.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testSingleServerRequest() { try { RestAssured.defaultParser = Parser.TEXT; RestAssured.when().get("/hello") .then() .statusCode(200); Assertions.assertEquals(1, mockTracer.finishedSpans().size()); Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello", mockTracer.finishedSpans().get(0).operationName()); } finally { RestAssured.reset(); } }
Example #29
Source File: JaxRSTestCase.java From quarkus with Apache License 2.0 | 5 votes |
@Test public void testJaxb() throws Exception { try { // in the native image case, the right parser is not chosen, despite the content-type being correct RestAssured.defaultParser = Parser.XML; RestAssured.when().get("/test/xml").then() .body("xmlObject.value.text()", is("A Value")); } finally { RestAssured.reset(); } }
Example #30
Source File: MultipartPutIntegrationTest.java From api-layer with Eclipse Public License 2.0 | 5 votes |
@Test @TestsNotMeantForZowe public void shouldDoPostRequestAndMatchReturnBody() { RestAssured.registerParser("text/plain", Parser.JSON); URI uri = HttpRequestUtils.getUriFromGateway(MULTIPART_PATH); given(). contentType("multipart/form-data"). multiPart(new File(classLoader.getResource(configFileName).getFile())). expect(). statusCode(200). body("fileName", equalTo("example.txt")). body("fileType", equalTo("application/octet-stream")). when(). post(uri); }