Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intellj IDEA generated toString() methods are not well implemented #228

Open
DiabolusExMachina opened this issue Aug 22, 2018 · 1 comment

Comments

@DiabolusExMachina
Copy link

DiabolusExMachina commented Aug 22, 2018

Hi.

this library thinks that idea toString() methods are not well implemented.

public class Body {

  private String message;

  @Override public String toString() {
    return "Body{" +
      "message='" + message + '\'' +
      '}';
  }

//getter, setter, equals, hashcode ... 
}
Class test.Body has bad 'toString' method implementation.
The toString method should contain:
message=www.pojo.pl
But does not.
Result of toString:
Body{message='www.pojo.pl'}

So the problem seems that idea wraps the value of a field in single quotes if it is a String.

@elvisnovoa
Copy link

I have a similar issue.. my toString's return JSON so instead of message=www.pojo.pl it would return

{
  "message":"www.pojo.pl"
}

It would be nice if we could provide our own implementation of ToStringAssertions and override it to be more lenient ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants