diff options
author | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-29 14:50:04 +0100 |
---|---|---|
committer | Ilpo Ruotsalainen <ilpo.ruotsalainen@oath.com> | 2018-11-29 14:50:04 +0100 |
commit | f9d35db003e1035f0dd4ac529f241873fe3b065d (patch) | |
tree | bbf265b3ef1c0fad3a52cb667497b872ccd67169 /abi-check-plugin | |
parent | 0db179c65ddfc45379b0cbc6f0782ef538d1b76f (diff) |
Add test for AnnotationCollector.
Diffstat (limited to 'abi-check-plugin')
-rw-r--r-- | abi-check-plugin/src/test/java/com/yahoo/abicheck/AnnotationCollectorTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/abi-check-plugin/src/test/java/com/yahoo/abicheck/AnnotationCollectorTest.java b/abi-check-plugin/src/test/java/com/yahoo/abicheck/AnnotationCollectorTest.java new file mode 100644 index 00000000000..3104ce794cd --- /dev/null +++ b/abi-check-plugin/src/test/java/com/yahoo/abicheck/AnnotationCollectorTest.java @@ -0,0 +1,28 @@ +package com.yahoo.abicheck; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; + +import com.yahoo.abicheck.collector.AnnotationCollector; +import java.io.IOException; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.objectweb.asm.ClassReader; + +public class AnnotationCollectorTest { + + @Test + public void testCollection() throws IOException { + ClassReader r = new ClassReader( + "com.yahoo.abicheck.AnnotationCollectorTest$ClassWithAnnotations"); + AnnotationCollector collector = new AnnotationCollector(); + r.accept(collector, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); + + assertThat(collector.getAnnotations(), containsInAnyOrder(Disabled.class.getCanonicalName())); + } + + @Disabled // Any RetentionPolicy.RUNTIME annotation is fine for testing + private static class ClassWithAnnotations { + + } +} |