Compare commits
No commits in common. "bc884148aba32c737fc701ba23d3769453c6c9e9" and "340c5dc537a9484429746ec08d3069c0770deba0" have entirely different histories.
bc884148ab
...
340c5dc537
5 changed files with 0 additions and 131 deletions
|
|
@ -1,3 +0,0 @@
|
||||||
# runtime-role-matrix-live-20260714112301-v11-developer-001-attempt-1-run-9c63dd5c6aca
|
|
||||||
|
|
||||||
Forge 이슈 작업 브랜치 `forge/runtime-role-matrix-live-20260714112301-v11-developer-001-attempt-1-run-9c63dd5c6aca`.
|
|
||||||
43
pom.xml
43
pom.xml
|
|
@ -1,43 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
|
||||||
<version>3.2.5</version>
|
|
||||||
<relativePath/>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>com.example</groupId>
|
|
||||||
<artifactId>runtime-role-matrix-live</artifactId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>17</java.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
package com.example.demo;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class DemoApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(DemoApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package com.example.demo;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class RoleService {
|
|
||||||
|
|
||||||
public String getRoleName(String roleId) {
|
|
||||||
if (roleId == null || roleId.isBlank()) {
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
return switch (roleId.toUpperCase()) {
|
|
||||||
case "ADMIN" -> "Administrator";
|
|
||||||
case "DEVELOPER" -> "Developer";
|
|
||||||
case "VIEWER" -> "Viewer";
|
|
||||||
default -> "Role: " + roleId;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValidRole(String roleId) {
|
|
||||||
return roleId != null && !roleId.isBlank() &&
|
|
||||||
roleId.matches("^[A-Z_]+$");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
package com.example.demo;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
@SpringBootTest
|
|
||||||
class RoleServiceTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RoleService roleService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getRoleName_returnsAdministratorForAdmin() {
|
|
||||||
assertEquals("Administrator", roleService.getRoleName("ADMIN"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getRoleName_returnsDeveloperForDeveloper() {
|
|
||||||
assertEquals("Developer", roleService.getRoleName("DEVELOPER"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getRoleName_returnsUnknownForNull() {
|
|
||||||
assertEquals("UNKNOWN", roleService.getRoleName(null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void getRoleName_returnsUnknownForBlank() {
|
|
||||||
assertEquals("UNKNOWN", roleService.getRoleName(" "));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void isValidRole_returnsTrueForValidRoles() {
|
|
||||||
assertTrue(roleService.isValidRole("ADMIN"));
|
|
||||||
assertTrue(roleService.isValidRole("DEVELOPER"));
|
|
||||||
assertTrue(roleService.isValidRole("ROLE_VIEWER"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void isValidRole_returnsFalseForInvalidRoles() {
|
|
||||||
assertFalse(roleService.isValidRole(null));
|
|
||||||
assertFalse(roleService.isValidRole(""));
|
|
||||||
assertFalse(roleService.isValidRole("admin"));
|
|
||||||
assertFalse(roleService.isValidRole("ADMIN123"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue