BAEL-382 kotlin/java interperability example
This commit is contained in:
parent
faa3d322f8
commit
a269eba427
7
kotlin/src/main/java/com/baeldung/java/StringUtils.java
Normal file
7
kotlin/src/main/java/com/baeldung/java/StringUtils.java
Normal file
@ -0,0 +1,7 @@
|
||||
package com.baeldung.java;
|
||||
|
||||
public class StringUtils {
|
||||
public static String toUpperCase(String name) {
|
||||
return name.toUpperCase();
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.baeldung.kotlin
|
||||
|
||||
import com.baeldung.java.StringUtils
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
|
||||
class KotlinScalaInteroperabilityTest {
|
||||
@Test
|
||||
fun givenLowercaseString_whenExecuteMethodFromJavaStringUtils_shouldReturnStringUppercase() {
|
||||
//given
|
||||
val name = "tom"
|
||||
|
||||
//when
|
||||
val res = StringUtils.toUpperCase(name)
|
||||
|
||||
//then
|
||||
assertEquals(res, "TOM")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user