Questions tagged [equalsverifier]

Java tool that can be used in unit tests, to verify whether the contract for the equals and hashCode methods is met.

equalsverifier
Filter by
Sorted by
Tagged with
1 vote
1 answer
523 views

Equals Verifier fails with error related to hashcode check for JPA entity

Given we have such class: @Getter @Setter @NoArgsConstructor @AllArgsConstructor @Entity public class User { @Id private Long id; private String name; private Integer age; @...
ColdDeath's user avatar
3 votes
1 answer
2k views

EqualsVerifier: Unsupported class file major version 61

Java/Maven novice here, I'm trying to integrate EqualsVerifier into my code but am getting the following error java.lang.AssertionError: EqualsVerifier found a problem in class com.me.MyClass. -> ...
Madden's user avatar
  • 1,050
2 votes
1 answer
858 views

Equalsverifier fails when run with quarkus:dev

When running equalsverfier in quarkus dev mode, equalsverfier tests fail. I tried to test a class with equalsverifier. This works in my IDE. I tried to use it in quarkus dev mode (by running ./mvnw ...
Talip's user avatar
  • 23
1 vote
1 answer
85 views

How to change constructor arguments?

I have a record that performs a verification in its constructor as such : public record Configuration(URI url) { public Configuration(URI url) { Validate.httpValid(url, "url"); } } ...
Tristan MARIE's user avatar
5 votes
1 answer
2k views

EqualsVerifier in SpringBoot

I am creating the tests for two classes that share a list of data. When I use EqualsVerifier I get an error because it is asking me for a list with data shared by these two classes. This is the error: ...
sinfryd95's user avatar
  • 245
3 votes
2 answers
4k views

EqualsVerifier Assertion Error: Significant fields: equals does not use <fieldName>, or it is stateless

The setup, java 8 using lombok, meanbean and equalsverifier(huge fan of all 3, and also limited in what versions I can use per co. policy - on 2.3.3 of equalsverifier): @Data @NoArgsConstructor class ...
Firstname Lastname's user avatar
3 votes
1 answer
1k views

Why all fields used in equals should be also used in hashcode?

@Edit: I'm using this library http://jqno.nl/equalsverifier/ to check if equals and hashCode are written properly. Let's say we have this class: final class Why { private final int id; ...
MAGx2's user avatar
  • 3,169
2 votes
2 answers
1k views

Nexus doesn't download the complete artifact content from the Central repository

In our project we use the artifact <dependency> <groupId>nl.jqno.equalsverifier</groupId> <artifactId>equalsverifier</artifactId> <version>1.7.5</version&...
andreasgk's user avatar
  • 713
3 votes
1 answer
826 views

How to use EqualsVerifier in a Spock test

I have been writing my tests using spock. But to test Equals Hashcode contracts, I am trying to use EqualsVerifier. So my test code looks like: def "test equals hashcode contract"() { ...
Neel's user avatar
  • 2,100
9 votes
2 answers
8k views

Equals and hashCode contract with EqualsVerifier

I have some doubts about equals and hashCode contract in Java using EqualsVerifier library. Imagine we have something like this public abstract class Person { protected String name; @...
Manuelarte's user avatar
  • 1,740