Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nit99kumar/2692089eac4e390ff87309f5e8db4b8d to your computer and use it in GitHub Desktop.
Save nit99kumar/2692089eac4e390ff87309f5e8db4b8d to your computer and use it in GitHub Desktop.
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()
}
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}")
}
}
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