@Test public void convertEmptyListToJson() { mockQuery(Registration.findAll, Collections.EMPTY_LIST); final JsonArray result = this.cut.allAsJson(); assertNotNull(result); assertTrue(result.isEmpty()); }
public JsonArray allAsJson() { Collector<JsonObject, ?, JsonArrayBuilder> jsonCollector = Collector.of(Json::createArrayBuilder, JsonArrayBuilder::add, (left, right) -> { left.add(right); return left; }); return all().stream().map(this::convert). collect(jsonCollector).build(); }
Registrations { public JsonArray allAsJson() { Collector<JsonObject, ?, JsonArrayBuilder> jsonCollector = Collector.of(Json::createArrayBuilder, JsonArrayBuilder::add, (left, right) -> { left.add(right); return left; }); return all().stream().map(this::convert). collect(jsonCollector).build(); } }
Registrations { public JsonArray allAsJson() { Collector<JsonObject, ?, JsonArrayBuilder> jsonCollector = Collector.of(Json::createArrayBuilder, JsonArrayBuilder::add, (left, right) -> { left.add(right); return left; }); return all().stream().map(this::convert). collect(jsonCollector).build(); }  }
Registrations { public JsonArray allAsJson() { Collector<JsonObject, ?, JsonArrayBuilder> jsonCollector = Collector.of(Json::createArrayBuilder, JsonArrayBuilder::add, (left, right) -> { left.add(right); return left; }); return all().stream().map(this::convert). collect(jsonCollector).build(); }  JsonObject register(Registration request); Registration find(long registrationId); JsonObject findAsJson(int registrationId); List<Registration> all(); JsonArray allAsJson(); }
Registrations { public JsonArray allAsJson() { Collector<JsonObject, ?, JsonArrayBuilder> jsonCollector = Collector.of(Json::createArrayBuilder, JsonArrayBuilder::add, (left, right) -> { left.add(right); return left; }); return all().stream().map(this::convert). collect(jsonCollector).build(); }  JsonObject register(Registration request); Registration find(long registrationId); JsonObject findAsJson(int registrationId); List<Registration> all(); JsonArray allAsJson(); static final String CONFIRMATION_ID; }