Skip to content

Commit

Permalink
This no longer seems to throw an exception with Kapt (same as KSP?)
Browse files Browse the repository at this point in the history
  • Loading branch information
timyates committed Aug 30, 2023
1 parent 8bd87e9 commit 040041a
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
package io.micronaut.core.beans

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Test
import io.micronaut.core.reflect.exception.InstantiationException

class KotlinBeanIntrospectionSpec {

@Test
fun testWithValueOnKotlinDataClassWithDefaultValues() {
val introspection = BeanIntrospection.getIntrospection(SomeEntity::class.java)

assertThrows(InstantiationException::class.java) {
val instance = introspection.instantiate(10L, "foo")
val instance = introspection.instantiate(10L, "foo")

assertEquals(10, instance.id)
assertEquals("foo", instance.something)
assertEquals(10, instance.id)
assertEquals("foo", instance.something)

val changed = introspection.getRequiredProperty("something", String::class.java)
.withValue(instance, "changed")

assertEquals(10, changed.id)
assertEquals("changed", changed.something)
}
val changed = introspection.getRequiredProperty("something", String::class.java)
.withValue(instance, "changed")

assertEquals(10, changed.id)
assertEquals("changed", changed.something)
}

@Test
Expand Down

0 comments on commit 040041a

Please sign in to comment.