diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index c1fa830..cc5d678 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,6 +1,12 @@ +val versions = mapOf( + "kotlinx-datetime" to "0.6.2" +) + plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidLibrary) + id("dev.mokkery") version "2.0.0" + kotlin("plugin.allopen") version "2.1.10" } kotlin { @@ -25,7 +31,7 @@ kotlin { sourceSets { commonMain.dependencies { - //put your multiplatform dependencies here + implementation("org.jetbrains.kotlinx:kotlinx-datetime:${versions["kotlinx-datetime"]}") } commonTest.dependencies { implementation(libs.kotlin.test) @@ -44,3 +50,8 @@ android { targetCompatibility = JavaVersion.VERSION_1_8 } } + +allOpen { + annotation("com.tle.astrologylibrary.OpenForMokkery") + // annotations("com.another.Annotation", "com.third.Annotation") +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/tle/astrologylibrary/OpenForMokkery.kt b/shared/src/commonMain/kotlin/com/tle/astrologylibrary/OpenForMokkery.kt new file mode 100644 index 0000000..f37a50d --- /dev/null +++ b/shared/src/commonMain/kotlin/com/tle/astrologylibrary/OpenForMokkery.kt @@ -0,0 +1,3 @@ +package com.tle.astrologylibrary + +annotation class OpenForMokkery() \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/tle/astrologylibrary/Subject.kt b/shared/src/commonMain/kotlin/com/tle/astrologylibrary/Subject.kt new file mode 100644 index 0000000..512113b --- /dev/null +++ b/shared/src/commonMain/kotlin/com/tle/astrologylibrary/Subject.kt @@ -0,0 +1,7 @@ +package com.tle.astrologylibrary + +@OpenForMokkery +class A constructor() +@OpenForMokkery +class B constructor() +class Subject(val a: A, val b: B) \ No newline at end of file diff --git a/shared/src/commonTest/kotlin/com/tle/astrologylibrary/SubjectTest.kt b/shared/src/commonTest/kotlin/com/tle/astrologylibrary/SubjectTest.kt new file mode 100644 index 0000000..c655c8c --- /dev/null +++ b/shared/src/commonTest/kotlin/com/tle/astrologylibrary/SubjectTest.kt @@ -0,0 +1,16 @@ +package com.tle.astrologylibrary + +import dev.mokkery.mock +import kotlin.test.Test +import kotlin.test.assertEquals + +class SubjectTest { + @Test + fun testCreateSubject() { + val a = mock {} + val b = mock {} + val subject = Subject(a, b) + assertEquals(a, subject.a) + assertEquals(b, subject.b) + } +}