Initialize HemHub project foundation

This commit is contained in:
Urban Modig
2026-07-23 22:06:56 +02:00
commit 9957383e88
23 changed files with 2430 additions and 0 deletions

View File

@ -0,0 +1,18 @@
package se.rubble.hemhub;
import java.util.Map;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class HealthController {
@GetMapping("/health")
public Map<String, String> health() {
return Map.of("status", "UP");
}
}

View File

@ -0,0 +1,13 @@
package se.rubble.hemhub;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HemHubApplication {
public static void main(String[] args) {
SpringApplication.run(HemHubApplication.class, args);
}
}

View File

@ -0,0 +1,23 @@
package se.rubble.hemhub;
import org.junit.jupiter.api.Test;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
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;
class HealthControllerTest {
private final MockMvc mockMvc =
MockMvcBuilders.standaloneSetup(new HealthController()).build();
@Test
void healthReturnsUp() throws Exception {
mockMvc.perform(get("/api/health"))
.andExpect(status().isOk())
.andExpect(jsonPath("$.status").value("UP"));
}
}