diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java new file mode 100644 index 0000000..c60677c --- /dev/null +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java @@ -0,0 +1,15 @@ +package edu.harvard.dbmi.avillach.dictionary.info; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +@Controller +public class InfoController { + + @PostMapping("/info") + public ResponseEntity getInfo(@RequestBody Object ignored) { + return ResponseEntity.ok(new InfoResponse(":)")); + } +} diff --git a/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java new file mode 100644 index 0000000..5810c02 --- /dev/null +++ b/src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java @@ -0,0 +1,4 @@ +package edu.harvard.dbmi.avillach.dictionary.info; + +public record InfoResponse(String response) { +} diff --git a/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java b/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java new file mode 100644 index 0000000..ccf8e0d --- /dev/null +++ b/src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java @@ -0,0 +1,24 @@ +package edu.harvard.dbmi.avillach.dictionary.info; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + + +@SpringBootTest +class InfoControllerTest { + + @Autowired + InfoController infoController; + + @Test + void shouldGetInfo() { + ResponseEntity actual = infoController.getInfo(new Object()); + + Assertions.assertEquals(HttpStatus.OK, actual.getStatusCode()); + Assertions.assertEquals(new InfoResponse(":)"), actual.getBody()); + } +} \ No newline at end of file