|
| 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