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>
<version>1.0.0-SNAPSHOT</version>
<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>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
@ -28,6 +30,7 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<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 String getRole() {
return "DEVELOPER";
return "developer";
}
public boolean isAuthorized(String action) {
return "code".equals(action) || "review".equals(action) || "deploy".equals(action);
public boolean isActive() {
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;
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 {
@Autowired
private DeveloperService developerService;
@Test
void contextLoads() {
assertNotNull(developerService);
}
private final DeveloperService service = new DeveloperService();
@Test
void getRole_returnsDeveloper() {
assertEquals("DEVELOPER", developerService.getRole());
assertThat(service.getRole()).isEqualTo("developer");
}
@Test
void isAuthorized_forCodeAction_returnsTrue() {
assertTrue(developerService.isAuthorized("code"));
void isActive_returnsTrue() {
assertThat(service.isActive()).isTrue();
}
@Test
void isAuthorized_forReviewAction_returnsTrue() {
assertTrue(developerService.isAuthorized("review"));
}
@Test
void isAuthorized_forDeployAction_returnsTrue() {
assertTrue(developerService.isAuthorized("deploy"));
}
@Test
void isAuthorized_forUnknownAction_returnsFalse() {
assertFalse(developerService.isAuthorized("admin"));
void describe_returnsDescription() {
String description = service.describe();
assertThat(description).contains("Developer").contains("active");
}
}