Created
March 4, 2019 15:30
-
-
Save nit99kumar/2692089eac4e390ff87309f5e8db4b8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
application | |
kotlin("jvm") version "1.3.20" | |
} | |
application { | |
mainClassName = "org.example.MyLibrary.kt" | |
} | |
dependencies { | |
compile(kotlin("stdlib")) | |
implementation(kotlin("reflect")) | |
testImplementation(kotlin("test")) | |
testImplementation(kotlin("test-junit")) | |
} | |
repositories { | |
jcenter() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
data class Language( val name: String, val hotness: Int) | |
class MyLibrary { | |
fun kotlinLanguage() = Language("kotlin", 10) | |
fun main() { | |
val abc = "Nitesh" | |
println("${abc::class.qualifiedName}") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import org.junit.Assert.assertEquals | |
import org.junit.Test | |
class MyLibraryTest { | |
@Test fun testMyLanguage() { | |
assertEquals("kotlin", MyLibrary().kotlinLanguage().name) | |
assertEquals(10, MyLibrary().kotlinLanguage().hotness) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment