Skip to content

Commit 7c86dd1

Browse files
author
Luke Sikina
committed
[ALS-7349] Info endpoint
1 parent 8e48362 commit 7c86dd1

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package edu.harvard.dbmi.avillach.dictionary.info;
2+
3+
import org.springframework.http.ResponseEntity;
4+
import org.springframework.stereotype.Controller;
5+
import org.springframework.web.bind.annotation.PostMapping;
6+
import org.springframework.web.bind.annotation.RequestBody;
7+
8+
@Controller
9+
public class InfoController {
10+
11+
@PostMapping("/info")
12+
public ResponseEntity<InfoResponse> getInfo(@RequestBody Object ignored) {
13+
return ResponseEntity.ok(new InfoResponse(":)"));
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package edu.harvard.dbmi.avillach.dictionary.info;
2+
3+
public record InfoResponse(String response) {
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package edu.harvard.dbmi.avillach.dictionary.info;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
import org.springframework.http.HttpStatus;
8+
import org.springframework.http.ResponseEntity;
9+
10+
11+
@SpringBootTest
12+
class InfoControllerTest {
13+
14+
@Autowired
15+
InfoController infoController;
16+
17+
@Test
18+
void shouldGetInfo() {
19+
ResponseEntity<InfoResponse> actual = infoController.getInfo(new Object());
20+
21+
Assertions.assertEquals(HttpStatus.OK, actual.getStatusCode());
22+
Assertions.assertEquals(new InfoResponse(":)"), actual.getBody());
23+
}
24+
}

0 commit comments

Comments
 (0)