From 3351d96147c11b24ea0d2d2abec8ff3a677c413d Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 2 Jan 2017 11:51:12 +0100 Subject: [PATCH 01/15] BAEL-382 add kotlin module --- kotlin/pom.xml | 47 +++++++++++++++++++ .../src/main/kotlin/com/baeldung/Example1.kt | 5 ++ pom.xml | 2 + 3 files changed, 54 insertions(+) create mode 100644 kotlin/pom.xml create mode 100644 kotlin/src/main/kotlin/com/baeldung/Example1.kt diff --git a/kotlin/pom.xml b/kotlin/pom.xml new file mode 100644 index 0000000000..b93d867f0a --- /dev/null +++ b/kotlin/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + com.baeldung + kotlin + 1.0-SNAPSHOT + + + + org.jetbrains.kotlin + kotlin-stdlib + 1.0.4 + + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + kotlin-maven-plugin + org.jetbrains.kotlin + 1.0.4 + + + + compile + + compile + + + + + test-compile + + test-compile + + + + + + + + \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/Example1.kt b/kotlin/src/main/kotlin/com/baeldung/Example1.kt new file mode 100644 index 0000000000..9637ec9145 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/Example1.kt @@ -0,0 +1,5 @@ +package com.baeldung + +fun main(args: Array){ + println("hello word") +} diff --git a/pom.xml b/pom.xml index 19bec5bf81..b86a98c3c2 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,8 @@ jsoup junit5 + kotlin + log-mdc log4j log4j2 From 4d415f7f744ab4f906798be6fb30ea28a00a7a21 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 2 Jan 2017 14:48:05 +0100 Subject: [PATCH 02/15] BAEL-382 null-safety example --- kotlin/pom.xml | 13 +++++++++++- kotlin/src/main/kotlin/com/baeldung/Item.kt | 4 ++++ .../main/kotlin/com/baeldung/ItemService.kt | 10 ++++++++++ .../kotlin/com/baeldung/ItemServiceTest.kt | 20 +++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 kotlin/src/main/kotlin/com/baeldung/Item.kt create mode 100644 kotlin/src/main/kotlin/com/baeldung/ItemService.kt create mode 100644 kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt diff --git a/kotlin/pom.xml b/kotlin/pom.xml index b93d867f0a..59f71f91a6 100644 --- a/kotlin/pom.xml +++ b/kotlin/pom.xml @@ -14,6 +14,18 @@ kotlin-stdlib 1.0.4 + + org.jetbrains.kotlin + kotlin-test-junit + 1.0.4 + test + + + junit + junit + 4.12 + test + @@ -24,7 +36,6 @@ kotlin-maven-plugin org.jetbrains.kotlin 1.0.4 - compile diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/Item.kt new file mode 100644 index 0000000000..c0b6dd7631 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/Item.kt @@ -0,0 +1,4 @@ +package com.baeldung + + +data class Item(val id: String, val name: String) \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt new file mode 100644 index 0000000000..7597e2aca6 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -0,0 +1,10 @@ +package com.baeldung + +import java.util.* + +class ItemService { + fun findItemNameForId(id: String): Item? { + val itemId = UUID.randomUUID().toString() + return Item(itemId, "name-$itemId"); + } +} \ No newline at end of file diff --git a/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt b/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt new file mode 100644 index 0000000000..2442cb18b2 --- /dev/null +++ b/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt @@ -0,0 +1,20 @@ +package com.baeldung + +import org.junit.Test +import kotlin.test.assertNotNull + +class ItemServiceTest { + @Test + fun givenItemId_whenGetForOptionalName_shouldMakeActionOnNonNullValue() { + //given + val id = "item_id" + val itemService = ItemService() + + //when + val result = itemService.findItemNameForId(id) + + //then + assertNotNull(result?.let { it -> it.id }) + assertNotNull(result!!.id) + } +} \ No newline at end of file From 17148ca5e91a79f9cce9177f098c887751091da0 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 2 Jan 2017 16:22:27 +0100 Subject: [PATCH 03/15] BAEL-382 Add extension function that works on list --- kotlin/src/main/kotlin/com/baeldung/Item.kt | 2 +- .../main/kotlin/com/baeldung/ListExtension.kt | 15 +++++++++++++++ .../kotlin/com/baeldung/ListExtensionTest.kt | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 kotlin/src/main/kotlin/com/baeldung/ListExtension.kt create mode 100644 kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/Item.kt index c0b6dd7631..642b7d6274 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Item.kt +++ b/kotlin/src/main/kotlin/com/baeldung/Item.kt @@ -1,4 +1,4 @@ package com.baeldung -data class Item(val id: String, val name: String) \ No newline at end of file +data class Item(val id: String, val name: String = "unknown_name") \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt b/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt new file mode 100644 index 0000000000..79d2daa1dc --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt @@ -0,0 +1,15 @@ +package com.baeldung + +import java.util.concurrent.ThreadLocalRandom + + +class ListExtension { + fun List.random(): T? { + if (this.isEmpty()) return null + return get(ThreadLocalRandom.current().nextInt(count())) + } + + fun getRandomElementOfList(list: List): T? { + return list.random() + } +} \ No newline at end of file diff --git a/kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt b/kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt new file mode 100644 index 0000000000..42453f2057 --- /dev/null +++ b/kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt @@ -0,0 +1,18 @@ +package com.baeldung + +import org.junit.Test +import kotlin.test.assertTrue + +class ListExtensionTest { + @Test + fun givenList_whenExecuteExtensionFunctionOnList_shouldReturnRandomElementOfList(){ + //given + val elements = listOf("a", "b", "c") + + //when + val result = ListExtension().getRandomElementOfList(elements) + + //then + assertTrue(elements.contains(result)) + } +} \ No newline at end of file From 77fba546b30d1e0095004c80845faf460f59ff65 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 2 Jan 2017 16:32:04 +0100 Subject: [PATCH 04/15] BAEL-382 name of test --- kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt b/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt index 2442cb18b2..d681627f81 100644 --- a/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt +++ b/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt @@ -5,7 +5,7 @@ import kotlin.test.assertNotNull class ItemServiceTest { @Test - fun givenItemId_whenGetForOptionalName_shouldMakeActionOnNonNullValue() { + fun givenItemId_whenGetForOptionalItem_shouldMakeActionOnNonNullValue() { //given val id = "item_id" val itemService = ItemService() From b167fc5315ef527139ff9743140b71c1cf1beda5 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Mon, 2 Jan 2017 16:37:59 +0100 Subject: [PATCH 05/15] BAEL-382 formatting --- kotlin/src/main/kotlin/com/baeldung/Item.kt | 1 - kotlin/src/main/kotlin/com/baeldung/ListExtension.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/Item.kt index 642b7d6274..d145e894b3 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Item.kt +++ b/kotlin/src/main/kotlin/com/baeldung/Item.kt @@ -1,4 +1,3 @@ package com.baeldung - data class Item(val id: String, val name: String = "unknown_name") \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt b/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt index 79d2daa1dc..9245bf991d 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt @@ -2,7 +2,6 @@ package com.baeldung import java.util.concurrent.ThreadLocalRandom - class ListExtension { fun List.random(): T? { if (this.isEmpty()) return null From 8e89c9394b03c6680e9f1cd72b1e78b1cd897e99 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Wed, 4 Jan 2017 10:53:39 +0100 Subject: [PATCH 06/15] BAEL-19 introduce basic concstruct --- kotlin/src/main/kotlin/com/baeldung/Item.kt | 5 ++- .../main/kotlin/com/baeldung/ItemService.kt | 39 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/Item.kt index d145e894b3..6e552b3a42 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Item.kt +++ b/kotlin/src/main/kotlin/com/baeldung/Item.kt @@ -1,3 +1,6 @@ package com.baeldung -data class Item(val id: String, val name: String = "unknown_name") \ No newline at end of file +open class Item(val id: String, val name: String = "unknown_name") + +class ItemWithCategory(id: String, name: String, val categoryId: String) : Item(id, name) + diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index 7597e2aca6..0b1c419ab4 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -5,6 +5,43 @@ import java.util.* class ItemService { fun findItemNameForId(id: String): Item? { val itemId = UUID.randomUUID().toString() - return Item(itemId, "name-$itemId"); + return Item(itemId, "name-$itemId") } +} + +class ItemManager(val categoryId: String, val dbConnection: String) { + var email = "" + + constructor(categoryId: String, dbConnection: String, email: String) : this(categoryId, dbConnection) { + this.email = email + } + + fun isFromSpecificCategory(catId: String): Boolean { + return categoryId == catId + } + + fun makeAnalyisOfCategory(catId: String): Unit { + val result = if (catId == "100") "Yes" else "No" + println(result) + + } +} + +fun main(args: Array) { + val numbers = arrayOf("first", "second", "third", "fourth") + + for (n in numbers) { + println(n) + } + + for (i in 0..9) { + println(i) + } + + val firstName = "Tom" + val secondName = "Mary" + println("Names: $firstName, $secondName") + + val itemManager = ItemManager("cat_id", "db://connection") + print("function result: ${itemManager.isFromSpecificCategory("1")}") } \ No newline at end of file From 792f4649527ec94d8d237e337679c03a80af366a Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 7 Jan 2017 12:04:35 +0100 Subject: [PATCH 07/15] BAEL-19 add comments to repo links --- kotlin/pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kotlin/pom.xml b/kotlin/pom.xml index 59f71f91a6..bd58c8d5cd 100644 --- a/kotlin/pom.xml +++ b/kotlin/pom.xml @@ -9,17 +9,20 @@ 1.0-SNAPSHOT + org.jetbrains.kotlin kotlin-stdlib 1.0.4 + org.jetbrains.kotlin kotlin-test-junit 1.0.4 test + junit junit From 7b8d1dc6b2365b62e99039ebfde6eb769ab78c82 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 7 Jan 2017 12:10:59 +0100 Subject: [PATCH 08/15] BAEL-19 break long line --- kotlin/src/main/kotlin/com/baeldung/ItemService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index 0b1c419ab4..7c4ee5447d 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -12,7 +12,8 @@ class ItemService { class ItemManager(val categoryId: String, val dbConnection: String) { var email = "" - constructor(categoryId: String, dbConnection: String, email: String) : this(categoryId, dbConnection) { + constructor(categoryId: String, dbConnection: String, email: String) + : this(categoryId, dbConnection) { this.email = email } From 160b9ae6c30cc3f0bac5501c93b66bceb58ae77e Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 7 Jan 2017 12:15:18 +0100 Subject: [PATCH 09/15] BAEL-19 example of override --- kotlin/src/main/kotlin/com/baeldung/Item.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/Item.kt index 6e552b3a42..e1a5559cd2 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Item.kt +++ b/kotlin/src/main/kotlin/com/baeldung/Item.kt @@ -1,6 +1,14 @@ package com.baeldung -open class Item(val id: String, val name: String = "unknown_name") +open class Item(val id: String, val name: String = "unknown_name") { + open fun getIdOfItem(): String { + return id + } +} -class ItemWithCategory(id: String, name: String, val categoryId: String) : Item(id, name) +class ItemWithCategory(id: String, name: String, val categoryId: String) : Item(id, name) { + override fun getIdOfItem(): String { + return id + name + } +} From dee7d1ab12376bbeba1412ec95cae34dbceee4ff Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 7 Jan 2017 12:25:18 +0100 Subject: [PATCH 10/15] BAEL-19 iterate --- kotlin/src/main/kotlin/com/baeldung/ItemService.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index 7c4ee5447d..eff9b5f331 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -31,12 +31,14 @@ class ItemManager(val categoryId: String, val dbConnection: String) { fun main(args: Array) { val numbers = arrayOf("first", "second", "third", "fourth") + var concat = "" for (n in numbers) { - println(n) + concat += n } - for (i in 0..9) { - println(i) + var sum = 0 + for (i in 2..9) { + sum += i } val firstName = "Tom" From f5d8984ff5db6729b35ac5eaf1fa2d8ca53b7284 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 7 Jan 2017 12:29:40 +0100 Subject: [PATCH 11/15] BAEL-19 tempalte example --- kotlin/src/main/kotlin/com/baeldung/ItemService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index eff9b5f331..0adc709016 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -43,7 +43,8 @@ fun main(args: Array) { val firstName = "Tom" val secondName = "Mary" - println("Names: $firstName, $secondName") + val concatOfNames = "$firstName + $secondName" + println("Names: $concatOfNames") val itemManager = ItemManager("cat_id", "db://connection") print("function result: ${itemManager.isFromSpecificCategory("1")}") From e4286380784b3a5a7e8d593ee3c6b57c648808be Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Wed, 11 Jan 2017 18:06:17 +0100 Subject: [PATCH 12/15] BAEL-19 remove comments --- kotlin/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/kotlin/pom.xml b/kotlin/pom.xml index bd58c8d5cd..59f71f91a6 100644 --- a/kotlin/pom.xml +++ b/kotlin/pom.xml @@ -9,20 +9,17 @@ 1.0-SNAPSHOT - org.jetbrains.kotlin kotlin-stdlib 1.0.4 - org.jetbrains.kotlin kotlin-test-junit 1.0.4 test - junit junit From 79d13928e5ad489ff22ee893c5a36ba4d0d949da Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Wed, 11 Jan 2017 18:23:54 +0100 Subject: [PATCH 13/15] BAEL-19 more condition blocks examples --- .../main/kotlin/com/baeldung/ItemService.kt | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index 0adc709016..4a799a9901 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -47,5 +47,23 @@ fun main(args: Array) { println("Names: $concatOfNames") val itemManager = ItemManager("cat_id", "db://connection") - print("function result: ${itemManager.isFromSpecificCategory("1")}") + val result = "function result: ${itemManager.isFromSpecificCategory("1")}" + println(result) + + val number = 2 + if (number < 10) { + println("number less that 10") + } else if (number > 10) { + println("number is greater that 10") + } + + val name = "John" + when (name) { + "John" -> println("Hi man") + "Alice" -> println("Hi lady") + else -> { + println("Hi") + } + } + } \ No newline at end of file From fde39503a3f50457c86f0ffaaa75670e50df40c3 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Sat, 14 Jan 2017 19:27:43 +0100 Subject: [PATCH 14/15] BAEL-586 no need for else block --- kotlin/src/main/kotlin/com/baeldung/ItemService.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt index 4a799a9901..f117ea5c52 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/ItemService.kt @@ -61,9 +61,6 @@ fun main(args: Array) { when (name) { "John" -> println("Hi man") "Alice" -> println("Hi lady") - else -> { - println("Hi") - } } } \ No newline at end of file From 9512edb66714b7a268bf5160f3aa35bfe5aee55c Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Tue, 17 Jan 2017 09:54:51 +0100 Subject: [PATCH 15/15] BAEL-586 moved code to com.baeldung.kotlin package, use version properties in pom.xml --- kotlin/pom.xml | 15 +++++++++++---- .../kotlin/com/baeldung/{ => kotlin}/Example1.kt | 2 +- .../main/kotlin/com/baeldung/{ => kotlin}/Item.kt | 2 +- .../com/baeldung/{ => kotlin}/ItemService.kt | 2 +- .../com/baeldung/{ => kotlin}/ListExtension.kt | 2 +- .../com/baeldung/{ => kotlin}/ItemServiceTest.kt | 2 +- .../baeldung/{ => kotlin}/ListExtensionTest.kt | 3 ++- 7 files changed, 18 insertions(+), 10 deletions(-) rename kotlin/src/main/kotlin/com/baeldung/{ => kotlin}/Example1.kt (68%) rename kotlin/src/main/kotlin/com/baeldung/{ => kotlin}/Item.kt (91%) rename kotlin/src/main/kotlin/com/baeldung/{ => kotlin}/ItemService.kt (98%) rename kotlin/src/main/kotlin/com/baeldung/{ => kotlin}/ListExtension.kt (91%) rename kotlin/src/test/kotlin/com/baeldung/{ => kotlin}/ItemServiceTest.kt (93%) rename kotlin/src/test/kotlin/com/baeldung/{ => kotlin}/ListExtensionTest.kt (84%) diff --git a/kotlin/pom.xml b/kotlin/pom.xml index 59f71f91a6..eba248e1b9 100644 --- a/kotlin/pom.xml +++ b/kotlin/pom.xml @@ -12,18 +12,18 @@ org.jetbrains.kotlin kotlin-stdlib - 1.0.4 + ${kotlin-stdlib.version} org.jetbrains.kotlin kotlin-test-junit - 1.0.4 + ${kotlin-test-junit.version} test junit junit - 4.12 + ${junit.version} test @@ -35,7 +35,7 @@ kotlin-maven-plugin org.jetbrains.kotlin - 1.0.4 + ${kotlin-maven-plugin.version} compile @@ -55,4 +55,11 @@ + + 4.12 + 1.0.4 + 1.0.4 + 1.0.4 + + \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/Example1.kt b/kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt similarity index 68% rename from kotlin/src/main/kotlin/com/baeldung/Example1.kt rename to kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt index 9637ec9145..bca1e54a6c 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Example1.kt +++ b/kotlin/src/main/kotlin/com/baeldung/kotlin/Example1.kt @@ -1,4 +1,4 @@ -package com.baeldung +package com.baeldung.kotlin fun main(args: Array){ println("hello word") diff --git a/kotlin/src/main/kotlin/com/baeldung/Item.kt b/kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt similarity index 91% rename from kotlin/src/main/kotlin/com/baeldung/Item.kt rename to kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt index e1a5559cd2..36994e4994 100644 --- a/kotlin/src/main/kotlin/com/baeldung/Item.kt +++ b/kotlin/src/main/kotlin/com/baeldung/kotlin/Item.kt @@ -1,4 +1,4 @@ -package com.baeldung +package com.baeldung.kotlin open class Item(val id: String, val name: String = "unknown_name") { open fun getIdOfItem(): String { diff --git a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt b/kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt similarity index 98% rename from kotlin/src/main/kotlin/com/baeldung/ItemService.kt rename to kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt index f117ea5c52..3c0d2eacb1 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ItemService.kt +++ b/kotlin/src/main/kotlin/com/baeldung/kotlin/ItemService.kt @@ -1,4 +1,4 @@ -package com.baeldung +package com.baeldung.kotlin import java.util.* diff --git a/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt b/kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt similarity index 91% rename from kotlin/src/main/kotlin/com/baeldung/ListExtension.kt rename to kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt index 9245bf991d..da1773b7c9 100644 --- a/kotlin/src/main/kotlin/com/baeldung/ListExtension.kt +++ b/kotlin/src/main/kotlin/com/baeldung/kotlin/ListExtension.kt @@ -1,4 +1,4 @@ -package com.baeldung +package com.baeldung.kotlin import java.util.concurrent.ThreadLocalRandom diff --git a/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt b/kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt similarity index 93% rename from kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt rename to kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt index d681627f81..3d730b1283 100644 --- a/kotlin/src/test/kotlin/com/baeldung/ItemServiceTest.kt +++ b/kotlin/src/test/kotlin/com/baeldung/kotlin/ItemServiceTest.kt @@ -1,4 +1,4 @@ -package com.baeldung +package com.baeldung.kotlin import org.junit.Test import kotlin.test.assertNotNull diff --git a/kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt b/kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt similarity index 84% rename from kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt rename to kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt index 42453f2057..7a496e7437 100644 --- a/kotlin/src/test/kotlin/com/baeldung/ListExtensionTest.kt +++ b/kotlin/src/test/kotlin/com/baeldung/kotlin/ListExtensionTest.kt @@ -1,5 +1,6 @@ -package com.baeldung +package com.baeldung.kotlin +import com.baeldung.kotlin.ListExtension import org.junit.Test import kotlin.test.assertTrue