Skip to content

Instantly share code, notes, and snippets.

@sherl0cks
Last active March 6, 2020 23:11
Show Gist options
  • Save sherl0cks/3483f52d6e6eff352391dfbeaba26786 to your computer and use it in GitHub Desktop.
Save sherl0cks/3483f52d6e6eff352391dfbeaba26786 to your computer and use it in GitHub Desktop.
class RestClientTest {
@Inject
@field: RestClient
lateinit var postService: PostService
@Inject
@field: RestClient
lateinit var commentService: CommentService
@Test
fun test() {
Assertions.assertNotNull(postService)
Assertions.assertNotNull(commentService)
println(postService.get())
println(commentService.get())
}
@RegisterRestClient(baseUri = "https://jsonplaceholder.typicode.com/posts/1")
interface PostService {
@GET
@Produces("application/json")
fun get(): String
}
@RegisterRestClient(baseUri = "https://jsonplaceholder.typicode.com/comments/1")
interface CommentService {
@GET
@Produces("application/json")
fun get(): String
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment