|
| 1 | +/* |
| 2 | + * Copyright 2020 Red Hat, Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package io.smallrye.openapi.tck.extra; |
| 17 | + |
| 18 | +import io.smallrye.openapi.tck.extra.procrules.WidgetResourceWithAnnotations; |
| 19 | +import org.eclipse.microprofile.openapi.tck.AppTestBase; |
| 20 | +import org.jboss.arquillian.container.test.api.Deployment; |
| 21 | +import org.jboss.arquillian.container.test.api.RunAsClient; |
| 22 | +import org.jboss.shrinkwrap.api.ShrinkWrap; |
| 23 | +import org.jboss.shrinkwrap.api.spec.WebArchive; |
| 24 | +import org.testng.annotations.Test; |
| 25 | + |
| 26 | +import io.restassured.response.ValidatableResponse; |
| 27 | +import test.io.smallrye.openapi.tck.ExtraSuiteTestBase; |
| 28 | + |
| 29 | +/** |
| 30 | + * NOTE: It's not a TCK test, it only leverages the TCK test setup |
| 31 | + */ |
| 32 | +public class ProcessingRulesTest extends ExtraSuiteTestBase<ProcessingRulesTest.ProcessingRulesTestArquillian> { |
| 33 | + |
| 34 | + public static class ProcessingRulesTestArquillian extends AppTestBase { |
| 35 | + @Deployment(name = "processing-rules") |
| 36 | + public static WebArchive createDeployment() { |
| 37 | + return ShrinkWrap.create(WebArchive.class, "ProcessingRules.war") |
| 38 | + .addPackages(true, new String[] { "io.smallrye.openapi.tck.extra.procrules" }) |
| 39 | + .addAsManifestResource("set-model-reader.properties", "microprofile-config.properties") |
| 40 | + ; |
| 41 | + } |
| 42 | + |
| 43 | + @RunAsClient |
| 44 | + @Test(dataProvider = "formatProvider") |
| 45 | + public void testPathItems(String type) { |
| 46 | + ValidatableResponse vr = this.callEndpoint(type); |
| 47 | + vr.body("externalDocs.url", org.hamcrest.Matchers.notNullValue()); |
| 48 | + vr.body("externalDocs.url", org.hamcrest.Matchers.is("http://widget-external-docs.org")); |
| 49 | + vr.body("externalDocs.description", org.hamcrest.Matchers.notNullValue()); |
| 50 | + vr.body("externalDocs.description", org.hamcrest.Matchers.is("Widget resource external documentation")); |
| 51 | + } |
| 52 | + |
| 53 | + } |
| 54 | +} |
0 commit comments