Skip to content

Commit

Permalink
[ALS-7349] Info endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina authored and Luke-Sikina committed Sep 20, 2024
1 parent 8e48362 commit a26a253
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
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(":)"));
}
}
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) {
}
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());
}
}

0 comments on commit a26a253

Please sign in to comment.