This commit is contained in:
Kent Yao 2018-10-25 11:26:41 +08:00
parent f297be1214
commit c1a39552a7
2 changed files with 9 additions and 1 deletions

View File

@ -44,7 +44,7 @@ abstract class Handle(val handleId: HandleIdentifier) {
if (other.handleId != null) {
return false
}
} else if (!(handleId == other.handleId)) {
} else if (handleId != other.handleId) {
return false
}

View File

@ -27,6 +27,14 @@ class HandleSuite extends SparkFunSuite {
val handle3 = TestHandle3(handle2.handleId.toTHandleIdentifier)
assert(handle1 === handle2)
assert(handle1 === handle3)
val handle4 = TestHandle2(null)
assert(handle4.hashCode === 31)
assert(!handle4.equals(null))
assert(!handle4.equals(new Object))
assert(!handle2.equals(handle4))
assert(handle4.equals(handle4))
assert(!handle4.equals(handle2))
assert(handle2.equals(handle2))
}
}