16
16
17
17
package org .eclipse .microprofile .openapi .tck ;
18
18
19
+ import static org .eclipse .microprofile .openapi .tck .utils .TCKMatchers .hasOptionalEntry ;
19
20
import static org .eclipse .microprofile .openapi .tck .utils .TCKMatchers .itemOrSingleton ;
20
21
import static org .hamcrest .Matchers .allOf ;
21
22
import static org .hamcrest .Matchers .anEmptyMap ;
@@ -408,8 +409,7 @@ private void testBookingIdMethods(ValidatableResponse vr) {
408
409
}
409
410
410
411
bookingParameters = "paths.'/bookings/{id}'.get.parameters" ;
411
- vr .body (bookingParameters + ".findAll { it.name == 'id' }.style" , both (hasSize (1 )).and (contains ("simple" )));
412
-
412
+ vr .body (bookingParameters + ".findAll { it.name == 'id' }" , contains (hasOptionalEntry ("style" , "simple" )));
413
413
}
414
414
415
415
private void testAvailabilityGetParamater (ValidatableResponse vr ) {
@@ -690,7 +690,7 @@ public void testEncodingRequestBody(String type) {
690
690
ValidatableResponse vr = callEndpoint (type );
691
691
String s = "paths.'/user'.post.requestBody.content.'application/json'.encoding.email." ;
692
692
vr .body (s + "contentType" , equalTo ("text/plain" ));
693
- vr .body (s + "style" , equalTo ( "form" ));
693
+ vr .body (s , hasOptionalEntry ( "style" , "form" ));
694
694
vr .body (s + "explode" , equalTo (true ));
695
695
vr .body (s + "allowReserved" , equalTo (true ));
696
696
vr .body (s + "x-encoding" , equalTo ("test-encoding" ));
@@ -702,13 +702,13 @@ public void testEncodingResponses(String type) {
702
702
String s =
703
703
"paths.'/user/username/{username}'.put.responses.'200'.content.'application/json'.encoding.password." ;
704
704
vr .body (s + "contentType" , equalTo ("text/plain" ));
705
- vr .body (s + "style" , equalTo ( "form" ));
705
+ vr .body (s , hasOptionalEntry ( "style" , "form" ));
706
706
vr .body (s + "explode" , equalTo (true ));
707
707
vr .body (s + "allowReserved" , equalTo (true ));
708
708
709
709
String t = "paths.'/user/username/{username}'.put.responses.'200'.content.'application/xml'.encoding.password." ;
710
710
vr .body (t + "contentType" , equalTo ("text/plain" ));
711
- vr .body (t + "style" , equalTo ( "form" ));
711
+ vr .body (t , hasOptionalEntry ( "style" , "form" ));
712
712
vr .body (t + "explode" , equalTo (true ));
713
713
vr .body (t + "allowReserved" , equalTo (true ));
714
714
@@ -930,7 +930,7 @@ public void testHeaderInAPIResponse(String type) {
930
930
vr .body (responseHeader1 + ".required" , equalTo (true ));
931
931
vr .body (responseHeader1 + ".deprecated" , equalTo (true ));
932
932
vr .body (responseHeader1 + ".allowEmptyValue" , equalTo (true ));
933
- vr .body (responseHeader1 + ". style" , equalTo ( "simple" ));
933
+ vr .body (responseHeader1 , hasOptionalEntry ( " style" , "simple" ));
934
934
vr .body (responseHeader1 + ".schema.type" , itemOrSingleton ("integer" ));
935
935
936
936
String responseHeader2 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader2" ;
@@ -939,7 +939,7 @@ public void testHeaderInAPIResponse(String type) {
939
939
vr .body (responseHeader2 + ".required" , equalTo (true ));
940
940
vr .body (responseHeader2 + ".deprecated" , equalTo (true ));
941
941
vr .body (responseHeader2 + ".allowEmptyValue" , equalTo (true ));
942
- vr .body (responseHeader2 + ". style" , equalTo ( "simple" ));
942
+ vr .body (responseHeader2 , hasOptionalEntry ( " style" , "simple" ));
943
943
vr .body (responseHeader2 + ".schema.type" , itemOrSingleton ("string" ));
944
944
}
945
945
@@ -955,7 +955,7 @@ public void testHeaderInEncoding(String type) {
955
955
vr .body (testHeader + ".required" , equalTo (true ));
956
956
vr .body (testHeader + ".deprecated" , equalTo (true ));
957
957
vr .body (testHeader + ".allowEmptyValue" , equalTo (true ));
958
- vr .body (testHeader + ". style" , equalTo ( "simple" ));
958
+ vr .body (testHeader , hasOptionalEntry ( " style" , "simple" ));
959
959
vr .body (testHeader + ".schema.type" , itemOrSingleton ("integer" ));
960
960
}
961
961
@@ -988,7 +988,7 @@ public void testHeaderInComponents(String type) {
988
988
vr .body (maxRate + ".required" , equalTo (true ));
989
989
vr .body (maxRate + ".deprecated" , equalTo (true ));
990
990
vr .body (maxRate + ".allowEmptyValue" , equalTo (true ));
991
- vr .body (maxRate + ". style" , equalTo ( "simple" ));
991
+ vr .body (maxRate , hasOptionalEntry ( " style" , "simple" ));
992
992
vr .body (maxRate + ".schema.type" , itemOrSingleton ("integer" ));
993
993
vr .body (maxRate + ".x-header" , equalTo ("test-header" ));
994
994
}
0 commit comments