-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: adjust parsing of app.allowed_env_substitutions (#304)
SmallRyeConfig `getValue` doesn't allow the provided configured value to be empty, therefore use `getOptionalValue` instead. See also: eclipse/microprofile-config#407 Fixes #303
- Loading branch information
1 parent
a5756b5
commit 1936dda
Showing
3 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/test/java/com/mediamarktsaturn/technolinator/CustomTestProfiles.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.mediamarktsaturn.technolinator; | ||
|
||
import io.quarkus.test.junit.QuarkusTestProfile; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
public class CustomTestProfiles { | ||
|
||
public static class AllowedEnvSubstitutions implements QuarkusTestProfile { | ||
@Override | ||
public Map<String, String> getConfigOverrides() { | ||
return Collections.singletonMap("app.allowed_env_substitutions", "substitution.1,substitution.2"); | ||
} | ||
} | ||
|
||
public static class EmptyAllowedEnvSubstitutions implements QuarkusTestProfile { | ||
@Override | ||
public Map<String, String> getConfigOverrides() { | ||
return Collections.singletonMap("app.allowed_env_substitutions", " "); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/test/java/com/mediamarktsaturn/technolinator/sbom/CdxgenClientOptionalEnvTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.mediamarktsaturn.technolinator.sbom; | ||
|
||
import com.mediamarktsaturn.technolinator.CustomTestProfiles; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
import jakarta.inject.Inject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@QuarkusTest | ||
@TestProfile(CustomTestProfiles.EmptyAllowedEnvSubstitutions.class) | ||
class CdxgenClientEmptyAllowedEnvSubstitutionsTest { | ||
|
||
@Inject | ||
CdxgenClient cut; | ||
|
||
@Test | ||
void testEmptyAllowedEnvSubstitutionsIsParsedWithoutError() { | ||
assertThat(cut.allowedEnvSubstitutions).isEmpty(); | ||
} | ||
} | ||
|
||
@QuarkusTest | ||
@TestProfile(CustomTestProfiles.AllowedEnvSubstitutions.class) | ||
class CdxgenClientAllowedEnvSubstitutionsTest { | ||
|
||
@Inject | ||
CdxgenClient cut; | ||
|
||
@Test | ||
void testEmptyAllowedEnvSubstitutionsIsParsedWithoutError() { | ||
assertThat(cut.allowedEnvSubstitutions).hasSize(2); | ||
assertThat(cut.allowedEnvSubstitutions).containsExactlyInAnyOrder("substitution.1", "substitution.2"); | ||
} | ||
} |