Compare commits
6 commits
main
...
forge/role
| Author | SHA1 | Date | |
|---|---|---|---|
| 7458b85678 | |||
| 575d6ebcb7 | |||
| 3d9fe0e272 | |||
| 2adb2af023 | |||
| 5f91cef2be | |||
| 4e860c4c6d |
6 changed files with 130 additions and 0 deletions
|
|
@ -0,0 +1,3 @@
|
|||
# role-developer-reverify-001-attempt-2-run-2442ff580a26
|
||||
|
||||
Forge 이슈 작업 브랜치 `forge/role-developer-reverify-001-attempt-2-run-2442ff580a26`.
|
||||
48
pom.xml
Normal file
48
pom.xml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?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-minimal</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>spring-minimal</name>
|
||||
<description>Spring Boot Minimal Application</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>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
12
src/main/java/com/example/SpringMinimalApplication.java
Normal file
12
src/main/java/com/example/SpringMinimalApplication.java
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package com.example;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class SpringMinimalApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringMinimalApplication.class, args);
|
||||
}
|
||||
}
|
||||
16
src/main/java/com/example/controller/HealthController.java
Normal file
16
src/main/java/com/example/controller/HealthController.java
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package com.example.controller;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class HealthController {
|
||||
|
||||
@GetMapping("/health")
|
||||
public ResponseEntity<Map<String, String>> health() {
|
||||
return ResponseEntity.ok(Map.of("status", "UP"));
|
||||
}
|
||||
}
|
||||
13
src/test/java/com/example/SpringMinimalApplicationTests.java
Normal file
13
src/test/java/com/example/SpringMinimalApplicationTests.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package com.example;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class SpringMinimalApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
// Verifies that the Spring context loads successfully
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
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.AutoConfigureMockMvc;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
@SpringBootTest
|
||||
@AutoConfigureMockMvc
|
||||
class HealthControllerTest {
|
||||
|
||||
@Autowired
|
||||
private MockMvc mockMvc;
|
||||
|
||||
@Test
|
||||
void healthEndpointReturnsUp() throws Exception {
|
||||
mockMvc.perform(get("/health"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.status", is("UP")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void healthEndpointReturnsJson() throws Exception {
|
||||
MvcResult result = mockMvc.perform(get("/health"))
|
||||
.andExpect(status().isOk())
|
||||
.andReturn();
|
||||
|
||||
String content = result.getResponse().getContentAsString();
|
||||
org.assertj.core.api.Assertions.assertThat(content)
|
||||
.contains("{\"status\":\"UP\"}");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue