DATACMNS-358 - Test case for 1-index pages in PagedResourcesAssembler.
Added a test case to show that PagedResourcesAssembler correctly renders 1-indexed, empty pages after upgrading to Spring HATEOAS 0.8.0.BUILD-SNAPSHOT.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -19,7 +19,7 @@
|
||||
<properties>
|
||||
<jackson>1.9.7</jackson>
|
||||
<jackson2>2.2.2</jackson2>
|
||||
<springhateoas>0.6.0.RELEASE</springhateoas>
|
||||
<springhateoas>0.8.0.BUILD-SNAPSHOT</springhateoas>
|
||||
<dist.key>DATACMNS</dist.key>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -100,6 +101,21 @@ public class PagedResourcesAssemblerUnitTests {
|
||||
assertThat(resources.getLink(Link.REL_NEXT).getHref(), startsWith(link.getHref()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-358
|
||||
*/
|
||||
@Test
|
||||
public void createsPagedResourcesForOneIndexedArgumentResolver() {
|
||||
|
||||
resolver.setOneIndexedParameters(true);
|
||||
PagedResourcesAssembler<Person> assembler = new PagedResourcesAssembler<Person>(resolver, null);
|
||||
|
||||
PageRequest request = new PageRequest(0, 1);
|
||||
Page<Person> page = new PageImpl<Person>(Collections.<Person> emptyList(), request, 0);
|
||||
|
||||
assembler.toResource(page);
|
||||
}
|
||||
|
||||
private static Page<Person> createPage(int index) {
|
||||
|
||||
PageRequest request = new PageRequest(index, 1);
|
||||
|
||||
Reference in New Issue
Block a user