From c5766f2bfeb55e82eeab5f0d4e0931a5c2bb5345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20G=C3=B3mez?= Date: Fri, 12 May 2017 01:36:35 -0600 Subject: [PATCH] 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 --- kotlin/README.md | 2 ++ .../com/baeldung/kotlin/EqualityTest.kt | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 kotlin/src/test/kotlin/com/baeldung/kotlin/EqualityTest.kt 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