use of de.codecentric.boot.admin.server.domain.values.Info in project spring-boot-admin by codecentric.
the class InstanceInfoChangedEventMixinTest method verifyDeserialize.
@Test
public void verifyDeserialize() throws JSONException, JsonProcessingException {
String json = new JSONObject().put("instance", "test123").put("version", 12345678L).put("timestamp", 1587751031.000000000).put("type", "INFO_CHANGED").put("info", new JSONObject().put("build", new JSONObject().put("version", "1.0.0")).put("foo", "bar")).toString();
InstanceInfoChangedEvent event = objectMapper.readValue(json, InstanceInfoChangedEvent.class);
assertThat(event).isNotNull();
assertThat(event.getInstance()).isEqualTo(InstanceId.of("test123"));
assertThat(event.getVersion()).isEqualTo(12345678L);
assertThat(event.getTimestamp()).isEqualTo(Instant.ofEpochSecond(1587751031).truncatedTo(ChronoUnit.SECONDS));
Info info = event.getInfo();
assertThat(info).isNotNull();
assertThat(info.getValues()).containsOnly(entry("build", Collections.singletonMap("version", "1.0.0")), entry("foo", "bar"));
}
Aggregations