spring-projects / spring-projects/spring-data-commons

org.springframework.data.domain.PageImpl's toString [DATACMNS-1640]

Open
#2,066 0 comments 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Mar 15, 2021.

for: team-attention in: core type: enhancement
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

Patrik Mihalcin opened DATACMNS-1640 and commented

toString implementation of PageImpl class doesn't include content.

Given I have this test written in Groovy:

import static java.util.Arrays.asList

import org.junit.Test
import org.springframework.data.domain.PageImpl
import org.springframework.data.domain.PageRequest

class PageTest {

@Test
void "different content, toString representation doesn't indicate it"() {
    Page<String> page1 = new PageImpl<>(asList("item1", "item2"), new PageRequest(0, 5), 10)
    Page<String> page2 = new PageImpl<>(asList("item1", "item3"), new PageRequest(0, 5), 10)
    assert page1 == page2
}
}

The error is reported as follows:

Assertion failed: 

assert page1 == page2
       |     |  |
       |     |  Page 1 of 2 containing java.lang.String instances
       |     false
       Page 1 of 2 containing java.lang.String instances

The same toString representation for different pages


No further details from DATACMNS-1640

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.