Skip to content

Commit c5766f2

Browse files
Walter Gómezpivovarit
authored andcommitted
Feature/kotlin equality (eugenp#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
1 parent dd3dab1 commit c5766f2

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎kotlin/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
- [Introduction to the Kotlin Language](http://www.baeldung.com/kotlin)
44
- [A guide to the “when{}” block in Kotlin](http://www.baeldung.com/kotlin-when)
55
- [Comprehensive Guide to Null Safety in Kotlin](http://www.baeldung.com/kotlin-null-safety)
6+
- [Kotlin Java Interoperability](http://www.baeldung.com/kotlin-java-interoperability)
7+
- [Difference Between “==” and “===” in Kotlin]()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.baeldung.kotlin
2+
3+
import org.junit.Test
4+
import kotlin.test.assertFalse
5+
import kotlin.test.assertTrue
6+
7+
class EqualityTest {
8+
9+
// Checks referential equality
10+
@Test
11+
fun givenTwoIntegers_whenCheckReference_thenEqualReference() {
12+
val a = Integer(10)
13+
val b = Integer(10)
14+
15+
assertFalse(a === b)
16+
}
17+
18+
// Checks structural equality
19+
@Test
20+
fun givenTwoIntegers_whenCheckValue_thenStructurallyEqual() {
21+
val a = Integer(10)
22+
val b = Integer(10)
23+
24+
assertTrue(a == b)
25+
}
26+
}

0 commit comments

Comments
 (0)