Cleanup in libraries

This commit is contained in:
Ilya Gorbunov
2015-12-29 19:21:39 +03:00
parent 92c2d17910
commit 19a4f65fd1
15 changed files with 32 additions and 44 deletions
+6 -18
View File
@@ -1,7 +1,6 @@
package test.annotations
import kotlin.*
import kotlin.test.assertTrue
import kotlin.test.*
import org.junit.Test as test
@Retention(AnnotationRetention.RUNTIME)
@@ -14,21 +13,10 @@ class AnnotatedClass
class AnnotationTest {
@test fun annotationType() {
val annotations = javaClass<AnnotatedClass>().getAnnotations()!!
var foundMyAnno = false
var foundDeprecated = false
for (annotation in annotations) {
val clazz = annotation!!.annotationType()
when {
clazz == javaClass<MyAnno>() -> foundMyAnno = true
clazz == javaClass<java.lang.Deprecated>() -> foundDeprecated = true
else -> {}
}
}
assertTrue(foundMyAnno)
assertTrue(foundDeprecated)
val kAnnotations = AnnotatedClass::class.java.annotations.map { it!!.annotationClass }
val jAnnotations = AnnotatedClass::class.java.annotations.map { it!!.annotationClass.java }
assertTrue(kAnnotations.containsAll(listOf(MyAnno::class, java.lang.Deprecated::class)))
assertTrue(jAnnotations.containsAll(listOf(MyAnno::class.java, java.lang.Deprecated::class.java)))
}
}