Skip to content

Commit

Permalink
Language configuration is now case sensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospereira committed Oct 6, 2023
1 parent a059cd3 commit 1888f90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public String implementationAnnotation() {
public Language language() {
String configuredLanguage = map.getOrDefault("language", "Java");
try {
return Language.valueOf(configuredLanguage.toUpperCase());
return Language.valueOf(configuredLanguage);
} catch (IllegalArgumentException ex) {
String supportedValues = Arrays.toString(Language.values());
throw new IllegalArgumentException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ public void languageConfigurationSupportsKotlin() {
}

@Test
public void languageConfigurationIsCaseInsensitive() {
var modelConfig = new ModelConfig(Map.of("language", "jAvA"));
assertEquals(modelConfig.language(), Language.JAVA);
public void languageConfigurationIsCaseSensitive() {
assertThrows(IllegalArgumentException.class, () -> {
new ModelConfig(Map.of("language", "jAvA")).language();
});
}

@Test
Expand Down

0 comments on commit 1888f90

Please sign in to comment.