Commit 876802bd authored by Maxym Borodenko's avatar Maxym Borodenko

Include sliceSize to JSON

parent 97b9a2c0
......@@ -18,6 +18,7 @@ package org.genesys2.server.api;
import java.io.Serializable;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.genesys.blocks.model.filters.EmptyModelFilter;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
......@@ -79,4 +80,9 @@ public class FilteredSlice<T> implements Serializable {
this.offset = offset == null ? 0 : offset;
}
@JsonProperty
public int getSliceSize() {
return this.content == null ? 0 : this.content.size();
}
}
......@@ -1526,6 +1526,7 @@ public class AccessionControllerTest extends AbstractAccessionControllerTest {
.andExpect(jsonPath("$.sort").isArray())
.andExpect(jsonPath("$.totalElements", is(3)))
.andExpect(jsonPath("$.offset", is(0))) // must be 0 by default
.andExpect(jsonPath("$.sliceSize", is(1)))
.andExpect(jsonPath("$.size").doesNotHaveJsonPath())
.andExpect(jsonPath("$.numberOfElements").doesNotHaveJsonPath())
.andExpect(jsonPath("$.number").doesNotHaveJsonPath())
......@@ -1558,6 +1559,7 @@ public class AccessionControllerTest extends AbstractAccessionControllerTest {
.andExpect(jsonPath("$.sort").isArray())
.andExpect(jsonPath("$.totalElements", is(3)))
.andExpect(jsonPath("$.offset", is(1)))
.andExpect(jsonPath("$.sliceSize", is(1)))
.andExpect(jsonPath("$.size").doesNotHaveJsonPath())
.andExpect(jsonPath("$.numberOfElements").doesNotHaveJsonPath())
.andExpect(jsonPath("$.number").doesNotHaveJsonPath())
......@@ -1603,6 +1605,7 @@ public class AccessionControllerTest extends AbstractAccessionControllerTest {
.andExpect(jsonPath("$.sort").isArray())
.andExpect(jsonPath("$.totalElements", is(3)))
.andExpect(jsonPath("$.offset").doesNotHaveJsonPath())
.andExpect(jsonPath("$.sliceSize").doesNotHaveJsonPath())
.andExpect(jsonPath("$.size", is(1)))
.andExpect(jsonPath("$.numberOfElements", is(1)))
.andExpect(jsonPath("$.number", is(1)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment