From cf72052df53f7f9b542324f8ca1cae722affb7f7 Mon Sep 17 00:00:00 2001 From: Laurentiu Delcea Date: Wed, 13 Feb 2019 01:20:38 +0200 Subject: [PATCH] BAEL-2651 Implement Java static methods equivalent (#6322) --- .../main/kotlin/com/baeldung/static/ConsoleUtils.kt | 10 ++++++++++ .../main/kotlin/com/baeldung/static/LoggingUtils.kt | 5 +++++ .../kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt | 10 ++++++++++ .../kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt | 10 ++++++++++ 4 files changed, 35 insertions(+) create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt create mode 100644 core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt create mode 100644 core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt b/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt new file mode 100644 index 0000000000..23c7cfb11a --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/static/ConsoleUtils.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +class ConsoleUtils { + companion object { + @JvmStatic + fun debug(debugMessage : String) { + println("[DEBUG] $debugMessage") + } + } +} \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt b/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt new file mode 100644 index 0000000000..e67addc9ea --- /dev/null +++ b/core-kotlin/src/main/kotlin/com/baeldung/static/LoggingUtils.kt @@ -0,0 +1,5 @@ +package com.baeldung.static + +fun debug(debugMessage : String) { + println("[DEBUG] $debugMessage") +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt new file mode 100644 index 0000000000..8abed144eb --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/static/ConsoleUtilsUnitTest.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +import org.junit.Test + +class ConsoleUtilsUnitTest { + @Test + fun givenAStaticMethod_whenCalled_thenNoErrorIsThrown() { + ConsoleUtils.debug("test message") + } +} \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt b/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt new file mode 100644 index 0000000000..59587ff009 --- /dev/null +++ b/core-kotlin/src/test/kotlin/com/baeldung/static/LoggingUtilsUnitTest.kt @@ -0,0 +1,10 @@ +package com.baeldung.static + +import org.junit.Test + +class LoggingUtilsUnitTest { + @Test + fun givenAPackageMethod_whenCalled_thenNoErrorIsThrown() { + debug("test message") + } +} \ No newline at end of file