diff --git a/kotlin/README.md b/kotlin/README.md index 309aafa4b6..950f6460d5 100644 --- a/kotlin/README.md +++ b/kotlin/README.md @@ -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]() diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt b/kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt new file mode 100644 index 0000000000..7cf2faaf42 --- /dev/null +++ b/kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt @@ -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) + } +} \ No newline at end of file