Skip to content

Commit

Permalink
Add displayname annotation to each test in the service.clientconfig p…
Browse files Browse the repository at this point in the history
…ackage
  • Loading branch information
MasterEvarior committed Dec 19, 2024
1 parent 4a8d07f commit 8824931
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import ch.puzzle.okr.dto.ClientConfigDto;
import ch.puzzle.okr.test.SpringIntegrationTest;
import jakarta.persistence.EntityNotFoundException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
Expand All @@ -22,7 +23,7 @@ class ClientConfigServiceIT {
@Autowired
private ClientConfigService clientConfigService;

@ParameterizedTest
@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 @@ -42,12 +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")
@Test
void getConfigBasedOnActiveEnvWithInvalidSubdomainThrowsException() {
assertThrowsExactly(EntityNotFoundException.class,
() -> clientConfigService.getConfigBasedOnActiveEnv("foobar.okr.puzzle.ch"));
}

@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,7 +18,7 @@

public class ClientConfigServiceTest {

@DisplayName("getConfigBasedOnActiveEnv() should be successful when tenant is configured properly")
@DisplayName("should be successful on getConfigBasedOnActiveEnv() when tenant is configured properly")
@ParameterizedTest
@CsvSource({ "pitc,pitc.ork.ch", "acme,acme-ork.ch" })
void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(String tenant, String hostname) {
Expand All @@ -34,7 +34,7 @@ void getConfigBasedOnActiveEnvShouldBeSuccessfulWhenTenantIsConfiguredProperly(S
assertClientConfigDto(configBasedOnActiveEnv, tenant);
}

@DisplayName("getConfigBasedOnActiveEnv() should throw exception if client customization is not found")
@DisplayName("should throw exception on getConfigBasedOnActiveEnv() when client customization is not found")
@ParameterizedTest
@CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" })
void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFound(String tenant, String hostname,
Expand All @@ -51,7 +51,7 @@ void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientCustomizationIsNotFoun
assertEquals(expectedErrorMessage, entityNotFoundException.getMessage());
}

@DisplayName("getConfigBasedOnActiveEnv() should throw exception if client config is not found")
@DisplayName("should throw exception getConfigBasedOnActiveEnv when client config is not found")
@ParameterizedTest
@CsvSource({ "pitc,pitc.okr.ch,pitc", "acme,acme-okr.ch,acme-okr" })
void getConfigBasedOnActiveEnvShouldThrowExceptionIfClientConfigIsNotFound(String tenant, String hostname,
Expand Down

0 comments on commit 8824931

Please sign in to comment.