Skip to content

Commit

Permalink
Fix displayname annotation for parameterized test in the service.clie…
Browse files Browse the repository at this point in the history
…ntconfig package
  • Loading branch information
MasterEvarior committed Dec 19, 2024
1 parent 5318404 commit c3ddc70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ClientConfigServiceIT {
@Autowired
private ClientConfigService clientConfigService;

@ParameterizedTest(name = "should get correct config on getConfigBasedOnActiveEnv() based on the hostname {0}, active profile {1}, issuer {2} and client id {3}")
@ParameterizedTest(name = "Should get correct config on getConfigBasedOnActiveEnv() based on the hostname {0}, active profile {1}, issuer {2} and client id {3}")
@MethodSource("tenantConfigs")
void getConfigBasedOnActiveEnvWithValidSubdomainReturnsCorrectTenantConfig(String hostname, String activeProfile,
String issuer, String clientId) {
Expand All @@ -43,14 +43,14 @@ private static Stream<Arguments> tenantConfigs() {
Arguments.of("acme.okr.puzzle.ch", "prod", "http://localhost:8544/realms/pitc", "acme_okr_staging"));
}

@DisplayName("should throw exception on getConfigBasedOnActiveEnv() when subdomain is invalid")
@DisplayName("Should throw exception on getConfigBasedOnActiveEnv() when subdomain is invalid")
@Test
void getConfigBasedOnActiveEnvWithInvalidSubdomainThrowsException() {
assertThrowsExactly(EntityNotFoundException.class,
() -> clientConfigService.getConfigBasedOnActiveEnv("foobar.okr.puzzle.ch"));
}

@DisplayName("should return config with correct values on getConfigBasedOnActiveEnv()")
@DisplayName("Should return config with correct values on getConfigBasedOnActiveEnv()")
@Test
void getClientConfigWithOtherValuesReturnsCorrectValues() {
// arrange + act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

public class ClientConfigServiceTest {

@DisplayName("should be successful on getConfigBasedOnActiveEnv() when tenant is configured properly")
@ParameterizedTest
@ParameterizedTest(name = "Should be successful on getConfigBasedOnActiveEnv() when tenant is configured properly with tenant {0} and hostname {1}")
@CsvSource({ "pitc,pitc.ork.ch", "acme,acme-ork.ch" })
void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(String tenant, String hostname) {
// arrange
Expand All @@ -34,8 +33,7 @@ void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(S
assertClientConfigDto(configBasedOnActiveEnv, tenant);
}

@DisplayName("should throw exception on getConfigBasedOnActiveEnv() when client customization is not found")
@ParameterizedTest
@ParameterizedTest(name = "Should throw exception on getConfigBasedOnActiveEnv() when client customization is not found for tenant {0}, hostname {1} and subdomain {2}")
@CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" })
void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFound(String tenant, String hostname,
String subdomain) {
Expand All @@ -51,8 +49,7 @@ void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFoun
assertEquals(expectedErrorMessage, entityNotFoundException.getMessage());
}

@DisplayName("should throw exception getConfigBasedOnActiveEnv when client config is not found")
@ParameterizedTest
@ParameterizedTest(name = "Should throw exception getConfigBasedOnActiveEnv when client config is not found for tenant {0}, hostname {1} and subdomain {2} ")
@CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" })
void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientConfigIsNotFound(String tenant, String hostname,
String subdomain) {
Expand Down

0 comments on commit c3ddc70

Please sign in to comment.