forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e48362
commit a26a253
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<InfoResponse> getInfo(@RequestBody Object ignored) { | ||
return ResponseEntity.ok(new InfoResponse(":)")); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/edu/harvard/dbmi/avillach/dictionary/info/InfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package edu.harvard.dbmi.avillach.dictionary.info; | ||
|
||
public record InfoResponse(String response) { | ||
} |
24 changes: 24 additions & 0 deletions
24
src/test/java/edu/harvard/dbmi/avillach/dictionary/info/InfoControllerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<InfoResponse> actual = infoController.getInfo(new Object()); | ||
|
||
Assertions.assertEquals(HttpStatus.OK, actual.getStatusCode()); | ||
Assertions.assertEquals(new InfoResponse(":)"), actual.getBody()); | ||
} | ||
} |