Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoloboschi committed Aug 20, 2024
1 parent 36458e2 commit 391f6f9
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
package ai.langstream.apigateway.auth.impl.jwt.admin;

import com.fasterxml.jackson.core.JsonProcessingException;
import static org.junit.jupiter.api.Assertions.*;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.*;
import lombok.SneakyThrows;
import org.junit.jupiter.api.Test;

class JwtAuthenticationProviderConfigurationTest {

protected static final ObjectMapper yamlConfigReader = new ObjectMapper(new YAMLFactory());

@Test
void parseCamelCase() {
final String yaml = """
final String yaml =
"""
adminRoles:
- admin
- super-admin
Expand All @@ -28,7 +27,7 @@ void parseCamelCase() {
publicKey: --key--
secretKey: --skey--
jwksHostsAllowlist: https://localhost
""";
final JwtAuthenticationProviderConfiguration tokenProperties = parse(yaml);
assertEquals(List.of("admin", "super-admin"), tokenProperties.adminRoles());
Expand All @@ -43,7 +42,8 @@ void parseCamelCase() {

@Test
void parseKebabCase() {
final String yaml = """
final String yaml =
"""
admin-roles:
- admin
- super-admin
Expand All @@ -54,7 +54,7 @@ void parseKebabCase() {
public-key: --key--
secret-key: --skey--
jwks-hosts-allowlist: https://localhost
""";
final JwtAuthenticationProviderConfiguration tokenProperties = parse(yaml);
assertEquals(List.of("admin", "super-admin"), tokenProperties.adminRoles());
Expand All @@ -74,4 +74,4 @@ private static JwtAuthenticationProviderConfiguration parse(String yaml) {
yamlConfigReader.convertValue(map, JwtAuthenticationProviderConfiguration.class);
return tokenProperties;
}
}
}

0 comments on commit 391f6f9

Please sign in to comment.