Compare commits
7 commits
main
...
forge/role
| Author | SHA1 | Date | |
|---|---|---|---|
| 64cb00e5a8 | |||
| a6d248bf1b | |||
| c27062d0e2 | |||
| c5d145cfb9 | |||
| 50a3e357ed | |||
| 933ebc056c | |||
| 9c9151e9c2 |
7 changed files with 54 additions and 30 deletions
|
|
@ -0,0 +1,3 @@
|
|||
# role-developer-live-v2-001-attempt-1-run-53f9c6cb3b6d
|
||||
|
||||
Forge 이슈 작업 브랜치 `forge/role-developer-live-v2-001-attempt-1-run-53f9c6cb3b6d`.
|
||||
5
pom.xml
5
pom.xml
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
src/main/resources/application.properties
Normal file
1
src/main/resources/application.properties
Normal file
|
|
@ -0,0 +1 @@
|
|||
spring.application.name=developer-role-smoke
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue