You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SetParams should implement equals and hashcode. Without those, verifying mock interactions is harder. For example,
@Test
void test() {
Jedis jedis = Mockito.mock(Jedis.class);
jedis.set("key", "value", new SetParams().ex(3600L));
Mockito.verify(jedis).set("key", "value", new SetParams().ex(3600L));
}
fails with
Argument(s) are different! Wanted:
jedis.set("key", "value", [ex, 3600]);
-> at x.test(x.java:89)
Actual invocations have different arguments:
jedis.set("key", "value", [ex, 3600]);
-> at x.test(x.java:88)
because of a lack of equals and hashcode on SetParams.
Expected behavior
SetParams should implement equals and hashcode. Without those, verifying mock interactions is harder. For example,
fails with
because of a lack of equals and hashcode on SetParams.
To write a passing test, one has to:
and know that the internal structure of SetParams is a map, that the private key is "ex", and that getParam's returned <T> is actually a Long.
Jedis version:
3.7.0
Redis version:
N/A
Java version:
11
Mockito version:
3.3.3
The text was updated successfully, but these errors were encountered: