1+ package io .swagger .v3 .jaxrs2 ;
2+
3+ import io .swagger .v3 .jaxrs2 .resources .APIResponsesResource ;
4+ import io .swagger .v3 .oas .integration .SwaggerConfiguration ;
5+ import io .swagger .v3 .oas .models .OpenAPI ;
6+ import io .swagger .v3 .oas .models .Operation ;
7+ import io .swagger .v3 .oas .models .media .Schema ;
8+ import org .testng .annotations .BeforeMethod ;
9+ import org .testng .annotations .Test ;
10+
11+ import static org .testng .AssertJUnit .assertEquals ;
12+
13+ public class APIResponsesResourceTest {
14+ private OpenAPI openAPI ;
15+
16+ @ BeforeMethod
17+ public void setUp () {
18+ SwaggerConfiguration config = new SwaggerConfiguration ().openAPI31 (true );
19+ Reader reader = new Reader (config );
20+ openAPI = reader .read (APIResponsesResource .class );
21+ }
22+
23+ private Schema getResponseSchema (String path ) {
24+ Operation postOperation = openAPI .getPaths ().get (path ).getPost ();
25+ return postOperation .getResponses ().get ("200" ).getContent ().get ("*/*" ).getSchema ();
26+ }
27+
28+ @ Test
29+ public void testStringOrEmailSchemaAPIResource31 () {
30+ Schema responseSchema = getResponseSchema ("/postStringOrEmailSchemaContent" );
31+
32+ // Value of field "type" must equal value of field "types"
33+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
34+ }
35+
36+ @ Test
37+ public void testBooleanSchemaAPIResource31 () {
38+ Schema responseSchema = getResponseSchema ("/postBooleanSchemaContent" );
39+
40+ // Value of field "type" must equal value of field "types"
41+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
42+ }
43+
44+ @ Test
45+ public void testByteOrBinarySchemaAPIResource31 () {
46+ Schema responseSchema = getResponseSchema ("/postByteOrBinarySchemaContent" );
47+
48+ // Value of field "type" must equal value of field "types"
49+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
50+ }
51+
52+ @ Test
53+ public void testURISchemaAPIResource31 () {
54+ Schema responseSchema = getResponseSchema ("/postURISchemaContent" );
55+
56+ // Value of field "type" must equal value of field "types"
57+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
58+ }
59+
60+ @ Test
61+ public void testURLSchemaAPIResource31 () {
62+ Schema responseSchema = getResponseSchema ("/postURLSchemaContent" );
63+
64+ // Value of field "type" must equal value of field "types"
65+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
66+ }
67+
68+ @ Test
69+ public void testUUIDSchemaAPIResource31 () {
70+ Schema responseSchema = getResponseSchema ("/postUUIDSchemaContent" );
71+
72+ // Value of field "type" must equal value of field "types"
73+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
74+ }
75+
76+ @ Test
77+ public void testIntegerSchemaAPIResource31 () {
78+ Schema responseSchema = getResponseSchema ("/postIntegerSchemaContent" );
79+
80+ // Value of field "type" must equal value of field "types"
81+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
82+ }
83+
84+ @ Test
85+ public void testLongSchemaAPIResource31 () {
86+ Schema responseSchema = getResponseSchema ("/postLongSchemaContent" );
87+
88+ // Value of field "type" must equal value of field "types"
89+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
90+ }
91+
92+ @ Test
93+ public void testFloatSchemaAPIResource31 () {
94+ Schema responseSchema = getResponseSchema ("/postFloatSchemaContent" );
95+
96+ // Value of field "type" must equal value of field "types"
97+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
98+ }
99+
100+ @ Test
101+ public void testDoubleSchemaAPIResource31 () {
102+ Schema responseSchema = getResponseSchema ("/postDoubleSchemaContent" );
103+
104+ // Value of field "type" must equal value of field "types"
105+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
106+ }
107+
108+ @ Test
109+ public void testBigIntegerSchemaAPIResource31 () {
110+ Schema responseSchema = getResponseSchema ("/postBigIntegerSchemaContent" );
111+
112+ // Value of field "type" must equal value of field "types"
113+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
114+ }
115+
116+ @ Test
117+ public void testBigDecimalSchemaAPIResource31 () {
118+ Schema responseSchema = getResponseSchema ("/postBigDecimalSchemaContent" );
119+
120+ // Value of field "type" must equal value of field "types"
121+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
122+ }
123+
124+ @ Test
125+ public void testNumberSchemaAPIResource31 () {
126+ Schema responseSchema = getResponseSchema ("/postNumberSchemaContent" );
127+
128+ // Value of field "type" must equal value of field "types"
129+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
130+ }
131+
132+ @ Test
133+ public void testDateStubSchemaAPIResource31 () {
134+ Schema responseSchema = getResponseSchema ("/postDateStubSchemaContent" );
135+
136+ // Value of field "type" must equal value of field "types"
137+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
138+ }
139+
140+ @ Test
141+ public void testDateSchemaAPIResource31 () {
142+ Schema responseSchema = getResponseSchema ("/postDateSchemaContent" );
143+
144+ // Value of field "type" must equal value of field "types"
145+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
146+ }
147+
148+ @ Test
149+ public void testLocalTimeSchemaAPIResource31 () {
150+ Schema responseSchema = getResponseSchema ("/postLocalTimeSchemaContent" );
151+
152+ // Value of field "type" must equal value of field "types"
153+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
154+ }
155+
156+ @ Test
157+ public void testFileSchemaAPIResource31 () {
158+ Schema responseSchema = getResponseSchema ("/postFileSchemaContent" );
159+
160+ // Value of field "type" must equal value of field "types"
161+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
162+ }
163+
164+ @ Test
165+ public void testObjectSchemaAPIResource31 () {
166+ Schema responseSchema = getResponseSchema ("/postObjectSchemaContent" );
167+
168+ // Value of field "type" must equal value of field "types"
169+ assertEquals (responseSchema .getType (), responseSchema .getTypes ().iterator ().next ());
170+ }
171+ }
0 commit comments