diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-09-15 20:37:58 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-09-15 20:37:58 -0400 |
commit | 6f87abbdabd02244a536acbf7f1895f4466a095d (patch) | |
tree | bf8819fd7a85b886dbd727157dae6a6a2b0db7d8 /sangria-core/src/test | |
parent | 7af926e2d02823c94a65310756f0ca7595908521 (diff) | |
parent | 75db2e06b7a6b1f15bad5986b33bc3aa1bb31f26 (diff) | |
download | sangria-6f87abbdabd02244a536acbf7f1895f4466a095d.tar.xz |
Merge branch 'lazy'
Diffstat (limited to 'sangria-core/src/test')
-rw-r--r-- | sangria-core/src/test/java/com/tavianator/sangria/core/PotentialAnnotationTest.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sangria-core/src/test/java/com/tavianator/sangria/core/PotentialAnnotationTest.java b/sangria-core/src/test/java/com/tavianator/sangria/core/PotentialAnnotationTest.java index c4ccc36..4c53ef4 100644 --- a/sangria-core/src/test/java/com/tavianator/sangria/core/PotentialAnnotationTest.java +++ b/sangria-core/src/test/java/com/tavianator/sangria/core/PotentialAnnotationTest.java @@ -36,7 +36,7 @@ import static org.junit.Assert.*; * Tests for {@link PotentialAnnotation}s. * * @author Tavian Barnes (tavianator@tavianator.com) - * @version 1.1 + * @version 1.2 * @since 1.1 */ public class PotentialAnnotationTest { @@ -63,8 +63,8 @@ public class PotentialAnnotationTest { @Test(expected = CreationException.class) public void testInvalidAnnotatedWithInstance() { - none.annotatedWith(Names.named("name")) - .annotatedWith(Names.named("name")); + none.annotatedWith(nameAnnotation) + .annotatedWith(nameAnnotation); } @Test @@ -78,6 +78,16 @@ public class PotentialAnnotationTest { } @Test + public void testFromKey() { + assertThat(PotentialAnnotation.from(new Key<String>() { }), + equalTo(none)); + assertThat(PotentialAnnotation.from(new Key<String>(Simple.class) { }), + equalTo(none.annotatedWith(Simple.class))); + assertThat(PotentialAnnotation.from(new Key<String>(nameAnnotation) { }), + equalTo(none.annotatedWith(nameAnnotation))); + } + + @Test public void testVisitor() { PotentialAnnotation.Visitor<String> visitor = new PotentialAnnotation.Visitor<String>() { @Override @@ -114,7 +124,7 @@ public class PotentialAnnotationTest { } /** - * Needed to avoid compilation error to to inferred type being anonymous class. + * Needed to avoid compilation error due to inferred type being anonymous class. */ private static <T> Matcher<Key<T>> equalTo(Key<T> key) { return Matchers.equalTo(key); |