Skip to content

Commit

Permalink
change external controller
Browse files Browse the repository at this point in the history
  • Loading branch information
xcodeassociated committed Sep 17, 2024
1 parent 4dcdb13 commit d9b0256
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ class ExternalController(
private val log = LogFactory.getLog(javaClass)

@GetMapping("/{id}")
fun getExternalResource(@PathVariable id: String): ResponseEntity<String> {
fun getExternalResource(@PathVariable id: String): ResponseEntity<SampleResponseDto> {
val data = externalServiceClient.fetchExternalResource(id)
log.info("External: Received $id, sending: ${data.toString()}")
return ResponseEntity.ok(data)
return ResponseEntity.ok(SampleResponseDto(data = data ?: "null"))
}
}
}

data class SampleResponseDto(val data: String)
6 changes: 5 additions & 1 deletion src/test/kotlin/com/softeno/template/app/IntegrationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ class ExternalControllerTest : BaseIntegrationTest(), ExternalApiAbility {
.exchange()
.expectStatus().isOk()
.expectBody()
.jsonPath("data").isEqualTo("1")
.jsonPath("data").isEqualTo("""
{
"data": "1"
}
""".trimIndent())
}
}

Expand Down

0 comments on commit d9b0256

Please sign in to comment.