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.
10
questions
1
vote
1
answer
70
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;
@...
2
votes
1
answer
491
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.
-> ...
2
votes
1
answer
484
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 ...
1
vote
1
answer
55
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");
}
}
...
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:
...
3
votes
1
answer
3k
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 ...
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;
...
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&...
3
votes
1
answer
773
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"() {
...
8
votes
2
answers
7k
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;
@...