model/src/test/java/eu/internetofus/common/model/DummyComplexModelTest.java
/**
   * Should to convert to buffer with empty values.
   *
   * @see DummyComplexModel#toBufferWithEmptyValues()
   */
Should to convert to buffer with empty values.
Should to convert to buffer with empty values .
@Override
  @Test
  public void shouldToBufferWithEmptyValues() {
    final var source = new DummyComplexModel();
    source.siblings = new ArrayList<>();
    source.siblings.add(new DummyComplexModel());
    final var expected = new JsonObject().put("index", 0).putNull("id")
        .put("siblings",
            new JsonArray().add(new JsonObject().put("index", 0).putNull("id").putNull("siblings").putNull("other")))
        .putNull("other");
    final var target = new JsonObject(source.toBufferWithEmptyValues());
    assertThat(target).isEqualTo(expected);
    assertThat(target.fieldNames()).isEqualTo(expected.fieldNames());
    assertThat(target.getJsonArray("siblings").getJsonObject(0).fieldNames())
        .isEqualTo(expected.getJsonArray("siblings").getJsonObject(0).fieldNames());
    super.shouldToBufferWithEmptyValues();
  }
@ Override @ Test public void shouldToBufferWithEmptyValues ( ) { final var source = new DummyComplexModel ( ) ; source . siblings = new ArrayList < > ( ) ; source . siblings . add ( new DummyComplexModel ( ) ) ; final var expected = new JsonObject ( ) . put ( "index" , 0 ) . putNull ( "id" ) . put ( "siblings" , new JsonArray ( ) . add ( new JsonObject ( ) . put ( "index" , 0 ) . putNull ( "id" ) . putNull ( "siblings" ) . putNull ( "other" ) ) ) . putNull ( "other" ) ; final var target = new JsonObject ( source . toBufferWithEmptyValues ( ) ) ; assertThat ( target ) . isEqualTo ( expected ) ; assertThat ( target . fieldNames ( ) ) . isEqualTo ( expected . fieldNames ( ) ) ; assertThat ( target . getJsonArray ( "siblings" ) . getJsonObject ( 0 ) . fieldNames ( ) ) . isEqualTo ( expected . getJsonArray ( "siblings" ) . getJsonObject ( 0 ) . fieldNames ( ) ) ; super . shouldToBufferWithEmptyValues ( ) ; }
Should to convert to buffer with empty values.
Should to convert to buffer with empty values .