Ejemplo n.º 1
0
  @Test
  public void testFullAppGet() throws Exception {
    Response response =
        applicationResource.getApplication(
            Version.V2.name(), MediaType.APPLICATION_JSON, EurekaAccept.full.name());

    String json = String.valueOf(response.getEntity());
    DecoderWrapper decoder = CodecWrappers.getDecoder(CodecWrappers.LegacyJacksonJson.class);

    Application decodedApp = decoder.decode(json, Application.class);
    assertThat(EurekaEntityComparators.equal(testApplication, decodedApp), is(true));
  }
Ejemplo n.º 2
0
  @Test
  public void testMiniAppGet() throws Exception {
    Response response =
        applicationResource.getApplication(
            Version.V2.name(), MediaType.APPLICATION_JSON, EurekaAccept.compact.name());

    String json = String.valueOf(response.getEntity());
    DecoderWrapper decoder = CodecWrappers.getDecoder(CodecWrappers.LegacyJacksonJson.class);

    Application decodedApp = decoder.decode(json, Application.class);
    // assert false as one is mini, so should NOT equal
    assertThat(EurekaEntityComparators.equal(testApplication, decodedApp), is(false));

    for (InstanceInfo instanceInfo : testApplication.getInstances()) {
      InstanceInfo decodedInfo = decodedApp.getByInstanceId(instanceInfo.getId());
      assertThat(EurekaEntityComparators.equalMini(instanceInfo, decodedInfo), is(true));
    }
  }