groostav
01/17/2017, 12:12 AMannotation class Thingy(val type: KClass<*>)
@Test fun `when using annotation class should work properly`(){
val thingies = AnnotatedThingy::class.annotations.filterIsInstance<Thingy>()
val KotlinIntType = Int::class
val JVMIntType = KotlinIntType.java
assertThat(thingies.single().type).isNotEqualTo(KotlinIntType).isEqualTo(JVMIntType)
val retrievedType: Any = thingies.single().type
assertThat(retrievedType).isNotEqualTo(JVMIntType).isEqualTo(KotlinIntType)
}
@Thingy(Int::class)
class AnnotatedThingy(val x: Int)