BAEL-2651 Implement Java static methods equivalent ()

This commit is contained in:
Laurentiu Delcea 2019-02-13 01:20:38 +02:00 committed by maibin
parent 0e178fe9c9
commit cf72052df5
4 changed files with 35 additions and 0 deletions
core-kotlin/src
main/kotlin/com/baeldung/static
test/kotlin/com/baeldung/static

@ -0,0 +1,10 @@
package com.baeldung.static
class ConsoleUtils {
companion object {
@JvmStatic
fun debug(debugMessage : String) {
println("[DEBUG] $debugMessage")
}
}
}

@ -0,0 +1,5 @@
package com.baeldung.static
fun debug(debugMessage : String) {
println("[DEBUG] $debugMessage")
}

@ -0,0 +1,10 @@
package com.baeldung.static
import org.junit.Test
class ConsoleUtilsUnitTest {
@Test
fun givenAStaticMethod_whenCalled_thenNoErrorIsThrown() {
ConsoleUtils.debug("test message")
}
}

@ -0,0 +1,10 @@
package com.baeldung.static
import org.junit.Test
class LoggingUtilsUnitTest {
@Test
fun givenAPackageMethod_whenCalled_thenNoErrorIsThrown() {
debug("test message")
}
}