Skip to content

Commit 4856974

Browse files
zigtermanakonczak
authored andcommitted
DATAES-402 - fixing paging information
1 parent 51f9485 commit 4856974

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

src/main/java/org/springframework/data/elasticsearch/core/FacetedPageImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* @author Artur Konczak
4949
* @author Jonathan Yan
5050
* @author Philipp Kräutli
51+
* @author Remco Zigterman
5152
*/
5253
@Deprecated
5354
public abstract class FacetedPageImpl<T> extends PageImpl<T> implements FacetedPage<T>, AggregatedPage<T> {
@@ -60,7 +61,7 @@ public FacetedPageImpl(List<T> content) {
6061
}
6162

6263
public FacetedPageImpl(List<T> content, Pageable pageable, long total) {
63-
super(content, Pageable.unpaged(), total);
64+
super(content, pageable, total);
6465
}
6566

6667
@Override
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2013-2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.elasticsearch.core.aggregation;
17+
18+
import static org.junit.Assert.assertEquals;
19+
20+
import org.junit.Test;
21+
import org.springframework.data.domain.Page;
22+
import org.springframework.data.domain.PageRequest;
23+
import org.springframework.data.elasticsearch.core.aggregation.impl.AggregatedPageImpl;
24+
25+
import java.util.Arrays;
26+
27+
/**
28+
* @author Remco Zigterman
29+
*/
30+
public class AggregatedPageImplTest {
31+
32+
@Test
33+
public void constructFacetedPageWithPageable() {
34+
Page<String> page = new AggregatedPageImpl<>(Arrays.asList("Test", "Test 2"), PageRequest.of(0, 2), 10);
35+
36+
assertEquals(10, page.getTotalElements());
37+
assertEquals(2, page.getNumberOfElements());
38+
assertEquals(2, page.getSize());
39+
assertEquals(5, page.getTotalPages());
40+
}
41+
}

0 commit comments

Comments
 (0)