Skip to content

Commit

Permalink
Update client/deployment/src/test/java/io/quarkiverse/openapi/generat…
Browse files Browse the repository at this point in the history
…or/deployment/authentication/OpenApiSpecProviderTest.java

Co-authored-by: Helber Belmiro <helber.belmiro@gmail.com>
  • Loading branch information
rmanibus and hbelmiro authored Sep 24, 2024
1 parent 5e48fd9 commit f8fddb7
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,26 @@ public class OpenApiSpecProviderTest {

@Test
public void checkCompositeProvider() {
Assertions.assertEquals(1, spec1CompositeProvider.getAuthenticationProviders().size());
Assertions.assertEquals(1, spec2CompositeProvider.getAuthenticationProviders().size());
Assertions.assertEquals(1, spec3CompositeProvider.getAuthenticationProviders().size());
// requires import static org.assertj.core.api.Assertions.assertThat;

assertThat(spec1CompositeProvider.getAuthenticationProviders()).hasSize(1);
assertThat(spec2CompositeProvider.getAuthenticationProviders()).hasSize(1);
assertThat(spec3CompositeProvider.getAuthenticationProviders()).hasSize(1);

AuthProvider authProvider = spec1CompositeProvider.getAuthenticationProviders().get(0);
Assertions.assertInstanceOf(OAuth2AuthenticationProvider.class, authProvider);
Assertions.assertEquals("oauth_auth", authProvider.getName());
Assertions.assertEquals("spec_1", ((OAuth2AuthenticationProvider) authProvider).getOpenApiSpecId());
assertThat(authProvider).isInstanceOf(OAuth2AuthenticationProvider.class);
assertThat(authProvider.getName()).isEqualTo("oauth_auth");
assertThat(((OAuth2AuthenticationProvider) authProvider).getOpenApiSpecId()).isEqualTo("spec_1");

authProvider = spec2CompositeProvider.getAuthenticationProviders().get(0);
Assertions.assertInstanceOf(BasicAuthenticationProvider.class, authProvider);
Assertions.assertEquals("basic_auth", authProvider.getName());
Assertions.assertEquals("spec_2", ((BasicAuthenticationProvider) authProvider).getOpenApiSpecId());
assertThat(authProvider).isInstanceOf(BasicAuthenticationProvider.class);
assertThat(authProvider.getName()).isEqualTo("basic_auth");
assertThat(((BasicAuthenticationProvider) authProvider).getOpenApiSpecId()).isEqualTo("spec_2");

authProvider = spec3CompositeProvider.getAuthenticationProviders().get(0);
Assertions.assertInstanceOf(ApiKeyAuthenticationProvider.class, authProvider);
Assertions.assertEquals("api_key", authProvider.getName());
Assertions.assertEquals("spec_3", ((ApiKeyAuthenticationProvider) authProvider).getOpenApiSpecId());

assertThat(authProvider).isInstanceOf(ApiKeyAuthenticationProvider.class);
assertThat(authProvider.getName()).isEqualTo("api_key");
assertThat(((ApiKeyAuthenticationProvider) authProvider).getOpenApiSpecId()).isEqualTo("spec_3");
}

@Test
Expand Down

0 comments on commit f8fddb7

Please sign in to comment.