1616
1717package org .eclipse .microprofile .openapi .tck ;
1818
19+ import static org .eclipse .microprofile .openapi .tck .utils .TCKMatchers .hasOptionalEntry ;
1920import static org .eclipse .microprofile .openapi .tck .utils .TCKMatchers .itemOrSingleton ;
2021import static org .hamcrest .Matchers .allOf ;
2122import static org .hamcrest .Matchers .anEmptyMap ;
@@ -408,8 +409,7 @@ private void testBookingIdMethods(ValidatableResponse vr) {
408409 }
409410
410411 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" )));
413413 }
414414
415415 private void testAvailabilityGetParamater (ValidatableResponse vr ) {
@@ -690,7 +690,7 @@ public void testEncodingRequestBody(String type) {
690690 ValidatableResponse vr = callEndpoint (type );
691691 String s = "paths.'/user'.post.requestBody.content.'application/json'.encoding.email." ;
692692 vr .body (s + "contentType" , equalTo ("text/plain" ));
693- vr .body (s + "style" , equalTo ( "form" ));
693+ vr .body (s , hasOptionalEntry ( "style" , "form" ));
694694 vr .body (s + "explode" , equalTo (true ));
695695 vr .body (s + "allowReserved" , equalTo (true ));
696696 vr .body (s + "x-encoding" , equalTo ("test-encoding" ));
@@ -702,13 +702,13 @@ public void testEncodingResponses(String type) {
702702 String s =
703703 "paths.'/user/username/{username}'.put.responses.'200'.content.'application/json'.encoding.password." ;
704704 vr .body (s + "contentType" , equalTo ("text/plain" ));
705- vr .body (s + "style" , equalTo ( "form" ));
705+ vr .body (s , hasOptionalEntry ( "style" , "form" ));
706706 vr .body (s + "explode" , equalTo (true ));
707707 vr .body (s + "allowReserved" , equalTo (true ));
708708
709709 String t = "paths.'/user/username/{username}'.put.responses.'200'.content.'application/xml'.encoding.password." ;
710710 vr .body (t + "contentType" , equalTo ("text/plain" ));
711- vr .body (t + "style" , equalTo ( "form" ));
711+ vr .body (t , hasOptionalEntry ( "style" , "form" ));
712712 vr .body (t + "explode" , equalTo (true ));
713713 vr .body (t + "allowReserved" , equalTo (true ));
714714
@@ -930,7 +930,7 @@ public void testHeaderInAPIResponse(String type) {
930930 vr .body (responseHeader1 + ".required" , equalTo (true ));
931931 vr .body (responseHeader1 + ".deprecated" , equalTo (true ));
932932 vr .body (responseHeader1 + ".allowEmptyValue" , equalTo (true ));
933- vr .body (responseHeader1 + ". style" , equalTo ( "simple" ));
933+ vr .body (responseHeader1 , hasOptionalEntry ( " style" , "simple" ));
934934 vr .body (responseHeader1 + ".schema.type" , itemOrSingleton ("integer" ));
935935
936936 String responseHeader2 = "paths.'/reviews/{id}'.get.responses.'200'.headers.responseHeader2" ;
@@ -939,7 +939,7 @@ public void testHeaderInAPIResponse(String type) {
939939 vr .body (responseHeader2 + ".required" , equalTo (true ));
940940 vr .body (responseHeader2 + ".deprecated" , equalTo (true ));
941941 vr .body (responseHeader2 + ".allowEmptyValue" , equalTo (true ));
942- vr .body (responseHeader2 + ". style" , equalTo ( "simple" ));
942+ vr .body (responseHeader2 , hasOptionalEntry ( " style" , "simple" ));
943943 vr .body (responseHeader2 + ".schema.type" , itemOrSingleton ("string" ));
944944 }
945945
@@ -955,7 +955,7 @@ public void testHeaderInEncoding(String type) {
955955 vr .body (testHeader + ".required" , equalTo (true ));
956956 vr .body (testHeader + ".deprecated" , equalTo (true ));
957957 vr .body (testHeader + ".allowEmptyValue" , equalTo (true ));
958- vr .body (testHeader + ". style" , equalTo ( "simple" ));
958+ vr .body (testHeader , hasOptionalEntry ( " style" , "simple" ));
959959 vr .body (testHeader + ".schema.type" , itemOrSingleton ("integer" ));
960960 }
961961
@@ -988,7 +988,7 @@ public void testHeaderInComponents(String type) {
988988 vr .body (maxRate + ".required" , equalTo (true ));
989989 vr .body (maxRate + ".deprecated" , equalTo (true ));
990990 vr .body (maxRate + ".allowEmptyValue" , equalTo (true ));
991- vr .body (maxRate + ". style" , equalTo ( "simple" ));
991+ vr .body (maxRate , hasOptionalEntry ( " style" , "simple" ));
992992 vr .body (maxRate + ".schema.type" , itemOrSingleton ("integer" ));
993993 vr .body (maxRate + ".x-header" , equalTo ("test-header" ));
994994 }
0 commit comments