Spring 전환 골격 최신 reviewer 검증 #1

Open
forge-bot wants to merge 7 commits from forge/role-developer-reverify-550-001-attempt-1-run-41adeb6fc379 into main
7 changed files with 161 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# role-developer-reverify-550-001-attempt-1-run-41adeb6fc379
Forge 이슈 작업 브랜치 `forge/role-developer-reverify-550-001-attempt-1-run-41adeb6fc379`.

53
pom.xml Normal file
View file

@ -0,0 +1,53 @@
<?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>spring-boot-minimal</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Spring Boot Minimal Application</name>
<description>Minimum compilable Spring Boot application for reviewer verification</description>
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,16 @@
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Main Spring Boot application entry point.
* This is the minimum required class to bootstrap a Spring application.
*/
@SpringBootApplication
public class SpringBootMinimalApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootMinimalApplication.class, args);
}
}

View file

@ -0,0 +1,26 @@
package com.example.controller;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* Simple REST controller for health check endpoint.
*/
@RestController
@RequestMapping("/api")
public class HealthController {
@GetMapping("/health")
public ResponseEntity<Map<String, String>> health() {
return ResponseEntity.ok(Map.of("status", "UP"));
}
@GetMapping("/ping")
public ResponseEntity<String> ping() {
return ResponseEntity.ok("pong");
}
}

View file

@ -0,0 +1,8 @@
# Spring Boot minimal configuration
spring.application.name=spring-boot-minimal
# Disable banner for cleaner test output
spring.main.banner-mode=off
# Test profile settings
spring.test.mockmvc.print=none

View file

@ -0,0 +1,20 @@
package com.example;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
/**
* Integration test to verify Spring Boot context loads successfully.
*/
@SpringBootTest
@TestPropertySource(properties = {
"spring.main.allow-bean-definition-overriding=true"
})
class SpringBootMinimalApplicationTests {
@Test
void contextLoads() {
// Verifies that the Spring application context loads without errors
}
}

View file

@ -0,0 +1,35 @@
package com.example.controller;
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.test.web.servlet.MockMvc;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Focused unit tests for HealthController.
* Uses @WebMvcTest for slice testing without full context.
*/
@WebMvcTest(HealthController.class)
class HealthControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
void health_shouldReturnUpStatus() throws Exception {
mockMvc.perform(get("/api/health"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status").value("UP"));
}
@Test
void ping_shouldReturnPong() throws Exception {
mockMvc.perform(get("/api/ping"))
.andExpect(status().isOk())
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.content().string("pong"));
}
}