Feature/kotlin equality (#1831)
* Add project for hibernate immutable article Add Event entity Add hibernate configuration file Add hibernateutil for configuration Add test to match snippets from article * Update master * Add simplet test to check Kotlin rerence vs strutural equality * Update README
This commit is contained in:
parent
dd3dab15cd
commit
c5766f2bfe
|
@ -3,3 +3,5 @@
|
|||
- [Introduction to the Kotlin Language](http://www.baeldung.com/kotlin)
|
||||
- [A guide to the “when{}” block in Kotlin](http://www.baeldung.com/kotlin-when)
|
||||
- [Comprehensive Guide to Null Safety in Kotlin](http://www.baeldung.com/kotlin-null-safety)
|
||||
- [Kotlin Java Interoperability](http://www.baeldung.com/kotlin-java-interoperability)
|
||||
- [Difference Between “==” and “===” in Kotlin]()
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.baeldung.kotlin
|
||||
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertFalse
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class EqualityTest {
|
||||
|
||||
// Checks referential equality
|
||||
@Test
|
||||
fun givenTwoIntegers_whenCheckReference_thenEqualReference() {
|
||||
val a = Integer(10)
|
||||
val b = Integer(10)
|
||||
|
||||
assertFalse(a === b)
|
||||
}
|
||||
|
||||
// Checks structural equality
|
||||
@Test
|
||||
fun givenTwoIntegers_whenCheckValue_thenStructurallyEqual() {
|
||||
val a = Integer(10)
|
||||
val b = Integer(10)
|
||||
|
||||
assertTrue(a == b)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue