Bläddra i källkod

:tada: Create first controller

Test it with : http://localhost:8080/status/health
DricomDragon 7 månader sedan
förälder
incheckning
b00c08c3d8

+ 15 - 0
squad-composer/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/StatusController.java

@@ -0,0 +1,15 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/status")
+public class StatusController {
+    
+    @GetMapping("/health")
+    public String healthCheck() {
+        return "hello";
+    }
+}

+ 13 - 0
squad-composer/src/test/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/StatusControllerTest.java

@@ -0,0 +1,13 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class StatusControllerTest {
+
+    @Test
+    void testHealthCheck() {
+        final StatusController sut = new StatusController();
+        Assertions.assertEquals("hello", sut.healthCheck());
+    }
+}