Developer 역할 Spring 골격 smoke #12

Open
forge-bot wants to merge 7 commits from forge/role-developer-live-v2-001-attempt-1-run-53f9c6cb3b6d into main
7 changed files with 54 additions and 30 deletions

View file

@ -0,0 +1,3 @@
# role-developer-live-v2-001-attempt-1-run-53f9c6cb3b6d
Forge 이슈 작업 브랜치 `forge/role-developer-live-v2-001-attempt-1-run-53f9c6cb3b6d`.

View file

@ -13,10 +13,12 @@
<artifactId>developer-role-smoke</artifactId> <artifactId>developer-role-smoke</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.0.0-SNAPSHOT</version>
<name>Developer Role Smoke Test</name> <name>Developer Role Smoke Test</name>
<description>Spring Boot skeleton for Developer role smoke test</description> <description>Spring Boot skeleton for developer role smoke test</description>
<properties> <properties>
<java.version>17</java.version> <java.version>17</java.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -28,6 +30,7 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View file

@ -0,0 +1,12 @@
package com.example.developer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DeveloperApplication {
public static void main(String[] args) {
SpringApplication.run(DeveloperApplication.class, args);
}
}

View file

@ -6,10 +6,14 @@ import org.springframework.stereotype.Service;
public class DeveloperService { public class DeveloperService {
public String getRole() { public String getRole() {
return "DEVELOPER"; return "developer";
} }
public boolean isAuthorized(String action) { public boolean isActive() {
return "code".equals(action) || "review".equals(action) || "deploy".equals(action); return true;
}
public String describe() {
return "Developer role is active and operational";
} }
} }

View file

@ -0,0 +1 @@
spring.application.name=developer-role-smoke

View file

@ -0,0 +1,19 @@
package com.example.developer;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
class DeveloperApplicationTests {
@Autowired
private DeveloperApplication application;
@Test
void contextLoads() {
assertThat(application).isNotNull();
}
}

View file

@ -1,44 +1,26 @@
package com.example.developer.service; package com.example.developer.service;
import org.junit.jupiter.api.Test; 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.*; import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest
class DeveloperServiceTest { class DeveloperServiceTest {
@Autowired private final DeveloperService service = new DeveloperService();
private DeveloperService developerService;
@Test
void contextLoads() {
assertNotNull(developerService);
}
@Test @Test
void getRole_returnsDeveloper() { void getRole_returnsDeveloper() {
assertEquals("DEVELOPER", developerService.getRole()); assertThat(service.getRole()).isEqualTo("developer");
} }
@Test @Test
void isAuthorized_forCodeAction_returnsTrue() { void isActive_returnsTrue() {
assertTrue(developerService.isAuthorized("code")); assertThat(service.isActive()).isTrue();
} }
@Test @Test
void isAuthorized_forReviewAction_returnsTrue() { void describe_returnsDescription() {
assertTrue(developerService.isAuthorized("review")); String description = service.describe();
} assertThat(description).contains("Developer").contains("active");
@Test
void isAuthorized_forDeployAction_returnsTrue() {
assertTrue(developerService.isAuthorized("deploy"));
}
@Test
void isAuthorized_forUnknownAction_returnsFalse() {
assertFalse(developerService.isAuthorized("admin"));
} }
} }