Last active
March 6, 2020 23:11
-
-
Save sherl0cks/3483f52d6e6eff352391dfbeaba26786 to your computer and use it in GitHub Desktop.
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
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