package com.marsdev.leo.service.test import javafx.stage.Stage import org.junit.Assert import org.junit.Test import org.testfx.api.FxToolkit import tornadofx.Rest import javax.json.Json import javax.json.JsonObject class RestClientTests { val primaryStage: Stage = FxToolkit.registerPrimaryStage() @Test fun testGet() { val api = Rest() api.baseURI = "http://localhost:8080" Assert.assertTrue(api.get("category").list()[0] != null) } @Test fun testPost() { // Rest.useApacheHttpClient() val api = Rest() api.baseURI = "http://localhost:8080" api.post("/item",getJson()) } fun getJson(): JsonObject { val builder = Json.createObjectBuilder() with (builder) { add("name", "test") } return builder.build() } }