BAEL-2651 Implement Java static methods equivalent (#6322)

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

View File

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

View File

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

View File

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

View File

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