Search in sources :

Example 1 with Endpoint

use of de.codecentric.boot.admin.server.domain.values.Endpoint in project spring-boot-admin by codecentric.

the class EndpointMixinTest method verifySerialize.

@Test
public void verifySerialize() throws IOException {
    Endpoint endpoint = Endpoint.of("info", "http://localhost:8080/info");
    JsonContent<Endpoint> jsonContent = jsonTester.write(endpoint);
    assertThat(jsonContent).extractingJsonPathStringValue("$.id").isEqualTo("info");
    assertThat(jsonContent).extractingJsonPathStringValue("$.url").isEqualTo("http://localhost:8080/info");
}
Also used : Endpoint(de.codecentric.boot.admin.server.domain.values.Endpoint) Test(org.junit.jupiter.api.Test)

Example 2 with Endpoint

use of de.codecentric.boot.admin.server.domain.values.Endpoint in project spring-boot-admin by codecentric.

the class EndpointMixinTest method verifyDeserialize.

@Test
public void verifyDeserialize() throws JSONException, JsonProcessingException {
    String json = new JSONObject().put("id", "info").put("url", "http://localhost:8080/info").toString();
    Endpoint endpoint = objectMapper.readValue(json, Endpoint.class);
    assertThat(endpoint).isNotNull();
    assertThat(endpoint.getId()).isEqualTo("info");
    assertThat(endpoint.getUrl()).isEqualTo("http://localhost:8080/info");
}
Also used : JSONObject(org.json.JSONObject) Endpoint(de.codecentric.boot.admin.server.domain.values.Endpoint) Test(org.junit.jupiter.api.Test)

Aggregations

Endpoint (de.codecentric.boot.admin.server.domain.values.Endpoint)2 Test (org.junit.jupiter.api.Test)2 JSONObject (org.json.JSONObject)1