Add unit tests with mocking

This commit is contained in:
Emil Simeonov 2025-02-16 02:41:40 +01:00
parent 6f762a40eb
commit 300bfbda1c
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,10 @@
package com.tle.astrologylibrary
@OpenForMokkery
class A constructor()
@OpenForMokkery
class B constructor()
class Subject(a: A, b: B) {
val a: A = a
val b: B = b
}

View File

@ -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<A> {}
val b = mock<B> {}
val subject = Subject(a, b)
assertEquals(a, subject.a)
assertEquals(b, subject.b)
}
}