@@ -79,21 +79,30 @@ private static Stream<Arguments> awsAuthServiceValues() {
7979
8080 @ ParameterizedTest
8181 @ MethodSource ("opValues" )
82- public void testIfOperationIsBearerAuth (AuthType serviceAuthType , AuthType opAuthType , Boolean expectedResult ) {
83- IntermediateModel model = modelWith (serviceAuthType );
84- OperationModel opModel = opModelWith (opAuthType );
85- assertThat (AuthUtils .isOpBearerAuth (model , opModel )).isEqualTo (expectedResult );
82+ public void testIfOperationIsBearerAuthPreferred (AuthType serviceAuthType , List <AuthType > serviceAuth ,
83+ AuthType opAuthType , List <AuthType > opAuth ,
84+ Boolean expectedResult ) {
85+ IntermediateModel model = modelWith (serviceAuthType , serviceAuth );
86+ OperationModel opModel = opModelWith (opAuthType , opAuth );
87+ assertThat (AuthUtils .isOpBearerAuthPreferred (model , opModel )).isEqualTo (expectedResult );
8688 }
8789
8890 private static Stream <Arguments > opValues () {
89- return Stream .of (Arguments .of (AuthType .BEARER , AuthType .BEARER , true ),
90- Arguments .of (AuthType .BEARER , AuthType .S3V4 , false ),
91- Arguments .of (AuthType .BEARER , AuthType .NONE , true ),
92- Arguments .of (AuthType .BEARER , null , true ),
93- Arguments .of (AuthType .S3V4 , AuthType .BEARER , true ),
94- Arguments .of (AuthType .S3V4 , AuthType .S3V4 , false ),
95- Arguments .of (AuthType .S3V4 , AuthType .NONE , false ),
96- Arguments .of (AuthType .S3V4 , null , false ));
91+ return Stream .of (
92+ Arguments .of (AuthType .BEARER , null , AuthType .BEARER , null , true ),
93+ Arguments .of (AuthType .BEARER , null , AuthType .S3V4 , null , false ),
94+ Arguments .of (AuthType .BEARER , null , AuthType .NONE , null , true ),
95+ Arguments .of (AuthType .BEARER , null , null , null , true ),
96+ Arguments .of (AuthType .S3V4 , null , AuthType .BEARER , null , true ),
97+ Arguments .of (AuthType .S3V4 , null , AuthType .S3V4 , null , false ),
98+ Arguments .of (AuthType .S3V4 , null , AuthType .NONE , null , false ),
99+ Arguments .of (AuthType .S3V4 , null , null , null , false ),
100+ Arguments .of (AuthType .S3V4 , Arrays .asList (AuthType .S3V4 , AuthType .BEARER ), AuthType .S3V4 , null , false ),
101+ Arguments .of (AuthType .S3V4 , null , AuthType .S3V4 , Arrays .asList (AuthType .S3V4 , AuthType .BEARER ), false ),
102+ Arguments .of (AuthType .S3V4 , Arrays .asList (AuthType .BEARER , AuthType .S3V4 ), null , null , true ),
103+ Arguments .of (AuthType .S3V4 , Arrays .asList (AuthType .BEARER , AuthType .S3V4 ), AuthType .S3V4 , null , false ),
104+ Arguments .of (AuthType .S3V4 , null , AuthType .S3V4 , Arrays .asList (AuthType .BEARER , AuthType .S3V4 ), true )
105+ );
97106 }
98107
99108 private static OperationModel opModelWith (AuthType authType ) {
@@ -102,6 +111,12 @@ private static OperationModel opModelWith(AuthType authType) {
102111 return opModel ;
103112 }
104113
114+ private static OperationModel opModelWith (AuthType authType , List <AuthType > auth ) {
115+ OperationModel opModel = opModelWith (authType );
116+ opModel .setAuth (auth );
117+ return opModel ;
118+ }
119+
105120 private static IntermediateModel modelWith (AuthType authType ) {
106121 IntermediateModel model = new IntermediateModel ();
107122 Metadata metadata = new Metadata ();
0 commit comments