File tree 3 files changed +43
-0
lines changed
main/java/edu/harvard/dbmi/avillach/dictionary/info
test/java/edu/harvard/dbmi/avillach/dictionary/info
3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
1
+ package edu .harvard .dbmi .avillach .dictionary .info ;
2
+
3
+ public record InfoResponse (String response ) {
4
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments