@@ -22,7 +22,7 @@ public void remoteDetailsWithAllFields() throws Exception {
22
22
assertThat ("incorrect fullname" , dets .getFullname (), is ("full" ));
23
23
assertThat ("incorrect email" , dets .getEmail (), is ("email" ));
24
24
assertThat ("incorrect mfa authenticated" , dets .getMfa (), is (MfaStatus .UNKNOWN ));
25
- assertThat ("incorrect hashcode " , dets . hashCode () , is (44648981 ));
25
+ assertThat ("incorrect equality " , dets , is (new RemoteIdentityDetails ( "user" , "full" , "email" ) ));
26
26
assertThat ("incorrect toString()" , dets .toString (),
27
27
is ("RemoteIdentityDetails [username=user, fullname=full, email=email, mfa=UNKNOWN]" ));
28
28
}
@@ -34,16 +34,15 @@ public void remoteDetailsWithEmptyFields() throws Exception {
34
34
assertThat ("incorrect fullname" , dets .getFullname (), is ((String ) null ));
35
35
assertThat ("incorrect email" , dets .getEmail (), is ((String ) null ));
36
36
assertThat ("incorrect mfa authenticated" , dets .getMfa (), is (MfaStatus .UNKNOWN ));
37
- assertThat ("incorrect hashcode" , dets .hashCode (), is (547016802 ));
38
37
assertThat ("incorrect toString()" , dets .toString (),
39
38
is ("RemoteIdentityDetails [username=user, fullname=null, email=null, mfa=UNKNOWN]" ));
40
-
39
+
41
40
final RemoteIdentityDetails dets2 = new RemoteIdentityDetails ("user" , null , null );
42
41
assertThat ("incorrect username" , dets2 .getUsername (), is ("user" ));
43
42
assertThat ("incorrect fullname" , dets2 .getFullname (), is ((String ) null ));
44
43
assertThat ("incorrect email" , dets2 .getEmail (), is ((String ) null ));
45
44
assertThat ("incorrect mfa authenticated" , dets2 .getMfa (), is (MfaStatus .UNKNOWN ));
46
- assertThat ("incorrect hashcode " , dets2 . hashCode () , is (547016802 ));
45
+ assertThat ("incorrect equality " , dets2 , is (dets ));
47
46
assertThat ("incorrect toString()" , dets2 .toString (),
48
47
is ("RemoteIdentityDetails [username=user, fullname=null, email=null, mfa=UNKNOWN]" ));
49
48
}
@@ -77,7 +76,7 @@ public void remoteId() throws Exception {
77
76
assertThat ("incorrect unique id" , id .getID (), is ("5c7d96a3dd7a87850a2ef34087565a6e" ));
78
77
// check unique id again to check memoization doesn't change result
79
78
assertThat ("incorrect unique id" , id .getID (), is ("5c7d96a3dd7a87850a2ef34087565a6e" ));
80
- assertThat ("incorrect hashcode " , id . hashCode () , is (3118804 ));
79
+ assertThat ("incorrect equality " , id , is (new RemoteIdentityID ( "foo" , "bar" ) ));
81
80
assertThat ("incorrect toString()" , id .toString (),
82
81
is ("RemoteIdentityID [provider=foo, id=bar]" ));
83
82
}
@@ -116,7 +115,8 @@ public void identity() throws Exception {
116
115
final RemoteIdentity ri = new RemoteIdentity (id , dets );
117
116
assertThat ("incorrect id" , ri .getRemoteID (), is (id ));
118
117
assertThat ("incorrect details" , ri .getDetails (), is (dets ));
119
- assertThat ("incorrect hashcode" , ri .hashCode (), is (-237603620 ));
118
+ assertThat ("incorrect equality" , ri , is (new RemoteIdentity (
119
+ new RemoteIdentityID ("p" , "i" ), new RemoteIdentityDetails ("u" , "f" , "e" ))));
120
120
assertThat ("incorrect toString()" , ri .toString (),
121
121
is ("RemoteIdentity [remoteID=RemoteIdentityID [provider=p, id=i], " +
122
122
"details=RemoteIdentityDetails [username=u, fullname=f, email=e, mfa=UNKNOWN]]" ));
0 commit comments