diff --git a/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md b/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md deleted file mode 100644 index ae2040e..0000000 --- a/.forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b.md +++ /dev/null @@ -1,3 +0,0 @@ -# role-developer-live-1522-001-attempt-1-run-6a48084c658b - -Forge 이슈 작업 브랜치 `forge/role-developer-live-1522-001-attempt-1-run-6a48084c658b`. diff --git a/pom.xml b/pom.xml deleted file mode 100644 index a9c2722..0000000 --- a/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.5 - - - com.example - demo - 0.0.1-SNAPSHOT - demo - Developer Role Spring Skeleton Application - - 17 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - \ No newline at end of file diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java deleted file mode 100644 index 2a9bdbe..0000000 --- a/src/main/java/com/example/demo/DemoApplication.java +++ /dev/null @@ -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); - } -} diff --git a/src/main/java/com/example/demo/controller/HelloController.java b/src/main/java/com/example/demo/controller/HelloController.java deleted file mode 100644 index 54f430c..0000000 --- a/src/main/java/com/example/demo/controller/HelloController.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.service.HelloService; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/api/hello") -public class HelloController { - - private final HelloService helloService; - - public HelloController(HelloService helloService) { - this.helloService = helloService; - } - - @GetMapping - public ResponseEntity greet() { - return ResponseEntity.ok(helloService.getGreeting()); - } - - @GetMapping("/{name}") - public ResponseEntity greetWithName(@PathVariable String name) { - return ResponseEntity.ok(helloService.getGreetingFor(name)); - } -} diff --git a/src/main/java/com/example/demo/service/HelloService.java b/src/main/java/com/example/demo/service/HelloService.java deleted file mode 100644 index f2dfb2d..0000000 --- a/src/main/java/com/example/demo/service/HelloService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.example.demo.service; - -import org.springframework.stereotype.Service; - -@Service -public class HelloService { - - private static final String GREETING_TEMPLATE = "Hello, %s!"; - private static final String DEFAULT_GREETING = "Hello, World!"; - - public String getGreeting() { - return DEFAULT_GREETING; - } - - public String getGreetingFor(String name) { - if (name == null || name.isBlank()) { - return DEFAULT_GREETING; - } - return String.format(GREETING_TEMPLATE, name); - } -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 4e0b68a..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -spring.application.name=demo -server.port=8080 diff --git a/src/test/java/com/example/demo/DemoApplicationTests.java b/src/test/java/com/example/demo/DemoApplicationTests.java deleted file mode 100644 index f37ed66..0000000 --- a/src/test/java/com/example/demo/DemoApplicationTests.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.example.demo; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.TestPropertySource; - -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@TestPropertySource(properties = {"spring.main.allow-bean-definition-overriding=true"}) -class DemoApplicationTests { - - @Test - void contextLoads() { - // Smoke test: verify Spring context loads successfully - } -} diff --git a/src/test/java/com/example/demo/controller/HelloControllerTest.java b/src/test/java/com/example/demo/controller/HelloControllerTest.java deleted file mode 100644 index 85559c4..0000000 --- a/src/test/java/com/example/demo/controller/HelloControllerTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.example.demo.controller; - -import com.example.demo.service.HelloService; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; - -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@WebMvcTest(HelloController.class) -@DisplayName("HelloController Unit Tests") -class HelloControllerTest { - - @Autowired - private MockMvc mockMvc; - - @MockBean - private HelloService helloService; - - @Test - @DisplayName("GET /api/hello returns default greeting") - void greet_ReturnsDefaultGreeting() throws Exception { - when(helloService.getGreeting()).thenReturn("Hello, World!"); - - mockMvc.perform(get("/api/hello") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string("Hello, World!")); - } - - @Test - @DisplayName("GET /api/hello/{name} returns personalized greeting") - void greetWithName_ReturnsPersonalizedGreeting() throws Exception { - when(helloService.getGreetingFor("Developer")).thenReturn("Hello, Developer!"); - - mockMvc.perform(get("/api/hello/Developer") - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string("Hello, Developer!")); - } -} diff --git a/src/test/java/com/example/demo/service/HelloServiceTest.java b/src/test/java/com/example/demo/service/HelloServiceTest.java deleted file mode 100644 index 55d748d..0000000 --- a/src/test/java/com/example/demo/service/HelloServiceTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.example.demo.service; - -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@DisplayName("HelloService Unit Tests") -class HelloServiceTest { - - private HelloService helloService; - - @BeforeEach - void setUp() { - helloService = new HelloService(); - } - - @Test - @DisplayName("getGreeting returns default greeting") - void getGreeting_ReturnsDefaultGreeting() { - String result = helloService.getGreeting(); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } - - @Test - @DisplayName("getGreetingFor returns personalized greeting") - void getGreetingFor_ReturnsPersonalizedGreeting() { - String result = helloService.getGreetingFor("Developer"); - - assertNotNull(result); - assertEquals("Hello, Developer!", result); - } - - @Test - @DisplayName("getGreetingFor with null returns default greeting") - void getGreetingFor_WithNull_ReturnsDefaultGreeting() { - String result = helloService.getGreetingFor(null); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } - - @Test - @DisplayName("getGreetingFor with blank string returns default greeting") - void getGreetingFor_WithBlankString_ReturnsDefaultGreeting() { - String result = helloService.getGreetingFor(" "); - - assertNotNull(result); - assertEquals("Hello, World!", result); - } -}