[seam-commits] Seam SVN: r13554 - sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Aug 4 13:40:14 EDT 2010


Author: lincolnthree
Date: 2010-08-04 13:40:14 -0400 (Wed, 04 Aug 2010)
New Revision: 13554

Added:
   sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/AnnotationTest.java
Modified:
   sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/ClassAnnotationTest.java
   sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/MethodAnnotationTest.java
Log:
Refactored tests to reduce test-duplication

Added: sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/AnnotationTest.java
===================================================================
--- sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/AnnotationTest.java	                        (rev 0)
+++ sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/AnnotationTest.java	2010-08-04 17:40:14 UTC (rev 13554)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.encore.grammar.java;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
+ */
+public abstract class AnnotationTest
+{
+   private AnnotationTarget<?> target;
+
+   public void setTarget(AnnotationTarget<?> target)
+   {
+      this.target = target;
+   }
+
+   @Before
+   public void reset()
+   {
+      resetTests();
+   }
+
+   public abstract void resetTests();
+
+   @Test
+   public void testParseAnnotation() throws Exception
+   {
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(3, annotations.size());
+      assertEquals("deprecation", annotations.get(1).getStringValue());
+      assertEquals("deprecation", annotations.get(1).getStringValue("value"));
+      assertEquals("value", annotations.get(1).getValues().get(0).getName());
+      assertEquals("deprecation", annotations.get(1).getValues().get(0).getStringValue());
+
+      assertEquals("unchecked", annotations.get(2).getStringValue("value"));
+      assertEquals("unchecked", annotations.get(2).getStringValue());
+      assertEquals("value", annotations.get(2).getValues().get(0).getName());
+      assertEquals("unchecked", annotations.get(2).getValues().get(0).getStringValue());
+   }
+
+   @Test
+   public void testAddAnnotation() throws Exception
+   {
+      int size = target.getAnnotations().size();
+      target.addAnnotation().setName("RequestScoped");
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 1, annotations.size());
+      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
+   }
+
+   @Test
+   public void testAddAnnotationByClass() throws Exception
+   {
+      int size = target.getAnnotations().size();
+      target.addAnnotation(Test.class);
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 1, annotations.size());
+      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
+      target.applyChanges();
+      assertTrue(target.toString().contains("@" + Test.class.getName()));
+   }
+
+   @Test
+   public void testAddAnnotationByName() throws Exception
+   {
+      int size = target.getAnnotations().size();
+      target.addAnnotation("RequestScoped");
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 1, annotations.size());
+      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
+      target.applyChanges();
+      assertTrue(target.toString().contains("@RequestScoped"));
+   }
+
+   @Test
+   public void testCanAddAnnotationDuplicate() throws Exception
+   {
+      int size = target.getAnnotations().size();
+      target.addAnnotation(Test.class);
+      target.addAnnotation(Test.class);
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 2, annotations.size());
+      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
+      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 2).getName());
+      target.applyChanges();
+      String pattern = "@" + Test.class.getName() + " " + "@" + Test.class.getName();
+      assertTrue(target.toString().contains(pattern));
+   }
+
+   @Test(expected = IllegalArgumentException.class)
+   public void testCannotAddAnnotationWithIllegalName() throws Exception
+   {
+      target.addAnnotation("sdf*(&#$%");
+   }
+
+   @Test
+   public void testAddLiteralValue() throws Exception
+   {
+      int size = target.getAnnotations().size();
+
+      target.addAnnotation(Test.class).setLiteralValue("435");
+      target.applyChanges();
+
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 1, annotations.size());
+
+      Annotation annotation = annotations.get(annotations.size() - 1);
+      assertEquals(Test.class.getName(), annotation.getName());
+      assertEquals("435", annotation.getLiteralValue());
+   }
+
+   @Test
+   public void testAddObjectValue() throws Exception
+   {
+      int size = target.getAnnotations().size();
+
+      target.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class").setLiteralValue("foo", "bar");
+      target.applyChanges();
+
+      List<Annotation> annotations = target.getAnnotations();
+      assertEquals(size + 1, annotations.size());
+
+      Annotation annotation = annotations.get(annotations.size() - 1);
+      assertEquals(Test.class.getName(), annotation.getName());
+      assertEquals(null, annotation.getLiteralValue());
+      assertEquals("RuntimeException.class", annotation.getLiteralValue("expected"));
+      assertEquals("bar", annotation.getLiteralValue("foo"));
+   }
+
+   @Test
+   public void testAddValueConvertsToNormalAnnotation() throws Exception
+   {
+      target.addAnnotation(Test.class).setLiteralValue("RuntimeException.class");
+      target.applyChanges();
+      Annotation annotation = target.getAnnotations().get(target.getAnnotations().size() - 1);
+
+      assertEquals("RuntimeException.class", annotation.getLiteralValue());
+      assertTrue(annotation.isSingleValue());
+
+      annotation.setLiteralValue("foo", "bar");
+      assertFalse(annotation.isSingleValue());
+      assertTrue(annotation.isNormal());
+
+      assertEquals("RuntimeException.class", annotation.getLiteralValue());
+      assertEquals("RuntimeException.class", annotation.getLiteralValue("value"));
+      assertEquals("bar", annotation.getLiteralValue("foo"));
+   }
+
+   @Test
+   public void testAnnotationBeginsAsMarker() throws Exception
+   {
+      Annotation anno = target.addAnnotation(Test.class);
+      assertTrue(anno.isMarker());
+      assertFalse(anno.isSingleValue());
+      assertFalse(anno.isNormal());
+
+      anno.setLiteralValue("\"Foo!\"");
+      assertFalse(anno.isMarker());
+      assertTrue(anno.isSingleValue());
+      assertFalse(anno.isNormal());
+
+      anno.setStringValue("bar", "Foo!");
+      assertFalse(anno.isMarker());
+      assertFalse(anno.isSingleValue());
+      assertTrue(anno.isNormal());
+
+      assertEquals("\"Foo!\"", anno.getLiteralValue("bar"));
+      assertEquals("Foo!", anno.getStringValue("bar"));
+
+      anno.removeAllValues();
+      assertTrue(anno.isMarker());
+      assertFalse(anno.isSingleValue());
+      assertFalse(anno.isNormal());
+   }
+
+   @Test
+   public void testRemoveAllValues() throws Exception
+   {
+      target.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class");
+      target.applyChanges();
+
+      List<Annotation> annotations = target.getAnnotations();
+      Annotation annotation = annotations.get(annotations.size() - 1);
+      annotation.removeAllValues();
+
+      assertEquals(0, annotation.getValues().size());
+   }
+}

Modified: sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/ClassAnnotationTest.java
===================================================================
--- sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/ClassAnnotationTest.java	2010-08-04 17:15:49 UTC (rev 13553)
+++ sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/ClassAnnotationTest.java	2010-08-04 17:40:14 UTC (rev 13554)
@@ -21,192 +21,18 @@
  */
 package org.jboss.encore.grammar.java;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.io.InputStream;
-import java.util.List;
 
-import org.junit.Before;
-import org.junit.Test;
-
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  */
-public class ClassAnnotationTest
+public class ClassAnnotationTest extends AnnotationTest
 {
-   private InputStream stream;
-   private JavaClass javaClass;
-
-   @Before
-   public void reset()
+   @Override
+   public void resetTests()
    {
-      stream = ClassAnnotationTest.class.getResourceAsStream("/org/jboss/encore/grammar/java/MockAnnotatedClassFile.java");
-      javaClass = JavaParser.parse(stream);
+      InputStream stream = ClassAnnotationTest.class.getResourceAsStream("/org/jboss/encore/grammar/java/MockAnnotatedClassFile.java");
+      JavaClass javaClass = JavaParser.parse(stream);
+      setTarget(javaClass);
    }
-
-   @Test
-   public void testParseAnnotation() throws Exception
-   {
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(3, annotations.size());
-      assertEquals("deprecation", annotations.get(1).getStringValue());
-      assertEquals("deprecation", annotations.get(1).getStringValue("value"));
-      assertEquals("value", annotations.get(1).getValues().get(0).getName());
-      assertEquals("deprecation", annotations.get(1).getValues().get(0).getStringValue());
-
-      assertEquals("unchecked", annotations.get(2).getStringValue("value"));
-      assertEquals("unchecked", annotations.get(2).getStringValue());
-      assertEquals("value", annotations.get(2).getValues().get(0).getName());
-      assertEquals("unchecked", annotations.get(2).getValues().get(0).getStringValue());
-   }
-
-   @Test
-   public void testAddAnnotation() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-      javaClass.addAnnotation().setName("RequestScoped");
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
-   }
-
-   @Test
-   public void testAddAnnotationByClass() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-      javaClass.addAnnotation(Test.class);
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
-      javaClass.applyChanges();
-      assertTrue(javaClass.toString().contains("@" + Test.class.getName()));
-   }
-
-   @Test
-   public void testAddAnnotationByName() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-      javaClass.addAnnotation("RequestScoped");
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
-      javaClass.applyChanges();
-      assertTrue(javaClass.toString().contains("@RequestScoped"));
-   }
-
-   @Test
-   public void testCanAddAnnotationDuplicate() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-      javaClass.addAnnotation(Test.class);
-      javaClass.addAnnotation(Test.class);
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 2, annotations.size());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 2).getName());
-      javaClass.applyChanges();
-      String pattern = "@" + Test.class.getName() + " " + "@" + Test.class.getName();
-      assertTrue(javaClass.toString().contains(pattern));
-   }
-
-   @Test(expected = IllegalArgumentException.class)
-   public void testCannotAddAnnotationWithIllegalName() throws Exception
-   {
-      javaClass.addAnnotation("sdf*(&#$%");
-   }
-
-   @Test
-   public void testAddLiteralValue() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-
-      javaClass.addAnnotation(Test.class).setLiteralValue("435");
-      javaClass.applyChanges();
-
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      assertEquals(Test.class.getName(), annotation.getName());
-      assertEquals("435", annotation.getLiteralValue());
-   }
-
-   @Test
-   public void testAddObjectValue() throws Exception
-   {
-      int size = javaClass.getAnnotations().size();
-
-      javaClass.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class").setLiteralValue("foo", "bar");
-      javaClass.applyChanges();
-
-      List<Annotation> annotations = javaClass.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      assertEquals(Test.class.getName(), annotation.getName());
-      assertEquals(null, annotation.getLiteralValue());
-      assertEquals("RuntimeException.class", annotation.getLiteralValue("expected"));
-      assertEquals("bar", annotation.getLiteralValue("foo"));
-   }
-
-   @Test
-   public void testAddValueConvertsToNormalAnnotation() throws Exception
-   {
-      javaClass.addAnnotation(Test.class).setLiteralValue("RuntimeException.class");
-      javaClass.applyChanges();
-      Annotation annotation = javaClass.getAnnotations().get(javaClass.getAnnotations().size() - 1);
-
-      assertEquals("RuntimeException.class", annotation.getLiteralValue());
-      assertTrue(annotation.isSingleValue());
-
-      annotation.setLiteralValue("foo", "bar");
-      assertFalse(annotation.isSingleValue());
-      assertTrue(annotation.isNormal());
-
-      assertEquals("RuntimeException.class", annotation.getLiteralValue());
-      assertEquals("RuntimeException.class", annotation.getLiteralValue("value"));
-      assertEquals("bar", annotation.getLiteralValue("foo"));
-   }
-
-   @Test
-   public void testAnnotationBeginsAsMarker() throws Exception
-   {
-      Annotation anno = javaClass.addAnnotation(Test.class);
-      assertTrue(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-
-      anno.setLiteralValue("\"Foo!\"");
-      assertFalse(anno.isMarker());
-      assertTrue(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-
-      anno.setStringValue("bar", "Foo!");
-      assertFalse(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertTrue(anno.isNormal());
-
-      assertEquals("\"Foo!\"", anno.getLiteralValue("bar"));
-      assertEquals("Foo!", anno.getStringValue("bar"));
-
-      anno.removeAllValues();
-      assertTrue(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-   }
-
-   @Test
-   public void testRemoveAllValues() throws Exception
-   {
-      javaClass.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class");
-      javaClass.applyChanges();
-
-      List<Annotation> annotations = javaClass.getAnnotations();
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      annotation.removeAllValues();
-
-      assertEquals(0, annotation.getValues().size());
-   }
 }

Modified: sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/MethodAnnotationTest.java
===================================================================
--- sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/MethodAnnotationTest.java	2010-08-04 17:15:49 UTC (rev 13553)
+++ sandbox/encore/core/src/test/java/org/jboss/encore/grammar/java/MethodAnnotationTest.java	2010-08-04 17:40:14 UTC (rev 13554)
@@ -21,195 +21,18 @@
  */
 package org.jboss.encore.grammar.java;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
 import java.io.InputStream;
-import java.util.List;
 
-import org.junit.Before;
-import org.junit.Test;
-
 /**
  * @author <a href="mailto:lincolnbaxter at gmail.com">Lincoln Baxter, III</a>
  */
-public class MethodAnnotationTest
+public class MethodAnnotationTest extends AnnotationTest
 {
-   private InputStream stream;
-   private JavaClass javaClass;
-   private Method method;
-
-   @Before
-   public void reset()
+   @Override
+   public void resetTests()
    {
-      stream = MethodAnnotationTest.class.getResourceAsStream("/org/jboss/encore/grammar/java/MockAnnotatedMethodFile.java");
-      javaClass = JavaParser.parse(stream);
-      method = javaClass.getMethods().get(0);
+      InputStream stream = MethodAnnotationTest.class.getResourceAsStream("/org/jboss/encore/grammar/java/MockAnnotatedMethodFile.java");
+      Method method = JavaParser.parse(stream).getMethods().get(0);
+      setTarget(method);
    }
-
-   @Test
-   public void testParseAnnotation() throws Exception
-   {
-      List<Annotation> annotations = method.getAnnotations();
-
-      assertEquals(3, annotations.size());
-      assertEquals("deprecation", annotations.get(1).getStringValue());
-      assertEquals("deprecation", annotations.get(1).getStringValue("value"));
-      assertEquals("value", annotations.get(1).getValues().get(0).getName());
-      assertEquals("deprecation", annotations.get(1).getValues().get(0).getStringValue());
-
-      assertEquals("unchecked", annotations.get(2).getStringValue("value"));
-      assertEquals("unchecked", annotations.get(2).getStringValue());
-      assertEquals("value", annotations.get(2).getValues().get(0).getName());
-      assertEquals("unchecked", annotations.get(2).getValues().get(0).getStringValue());
-   }
-
-   @Test
-   public void testAddAnnotation() throws Exception
-   {
-      int size = method.getAnnotations().size();
-      method.addAnnotation().setName("RequestScoped");
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
-   }
-
-   @Test
-   public void testAddAnnotationByClass() throws Exception
-   {
-      int size = method.getAnnotations().size();
-      method.addAnnotation(Test.class);
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
-      method.applyChanges();
-      assertTrue(method.toString().contains("@" + Test.class.getName()));
-   }
-
-   @Test
-   public void testAddAnnotationByName() throws Exception
-   {
-      int size = method.getAnnotations().size();
-      method.addAnnotation("RequestScoped");
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-      assertEquals("RequestScoped", annotations.get(annotations.size() - 1).getName());
-      method.applyChanges();
-      assertTrue(method.toString().contains("@RequestScoped"));
-   }
-
-   @Test
-   public void testCanAddAnnotationDuplicate() throws Exception
-   {
-      int size = method.getAnnotations().size();
-      method.addAnnotation(Test.class);
-      method.addAnnotation(Test.class);
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 2, annotations.size());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 1).getName());
-      assertEquals(Test.class.getName(), annotations.get(annotations.size() - 2).getName());
-      method.applyChanges();
-      String pattern = "@" + Test.class.getName() + " " + "@" + Test.class.getName();
-      assertTrue(method.toString().contains(pattern));
-   }
-
-   @Test(expected = IllegalArgumentException.class)
-   public void testCannotAddAnnotationWithIllegalName() throws Exception
-   {
-      method.addAnnotation("sdf*(&#$%");
-   }
-
-   @Test
-   public void testAddLiteralValue() throws Exception
-   {
-      int size = method.getAnnotations().size();
-
-      method.addAnnotation(Test.class).setLiteralValue("435");
-      method.applyChanges();
-
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      assertEquals(Test.class.getName(), annotation.getName());
-      assertEquals("435", annotation.getLiteralValue());
-   }
-
-   @Test
-   public void testAddObjectValue() throws Exception
-   {
-      int size = method.getAnnotations().size();
-
-      method.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class").setLiteralValue("foo", "bar");
-      method.applyChanges();
-
-      List<Annotation> annotations = method.getAnnotations();
-      assertEquals(size + 1, annotations.size());
-
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      assertEquals(Test.class.getName(), annotation.getName());
-      assertEquals(null, annotation.getLiteralValue());
-      assertEquals("RuntimeException.class", annotation.getLiteralValue("expected"));
-      assertEquals("bar", annotation.getLiteralValue("foo"));
-   }
-
-   @Test
-   public void testAddValueConvertsToNormalAnnotation() throws Exception
-   {
-      method.addAnnotation(Test.class).setLiteralValue("RuntimeException.class");
-      method.applyChanges();
-      Annotation annotation = method.getAnnotations().get(method.getAnnotations().size() - 1);
-
-      assertEquals("RuntimeException.class", annotation.getLiteralValue());
-      assertTrue(annotation.isSingleValue());
-
-      annotation.setLiteralValue("foo", "bar");
-      assertFalse(annotation.isSingleValue());
-      assertTrue(annotation.isNormal());
-
-      assertEquals("RuntimeException.class", annotation.getLiteralValue());
-      assertEquals("RuntimeException.class", annotation.getLiteralValue("value"));
-      assertEquals("bar", annotation.getLiteralValue("foo"));
-   }
-
-   @Test
-   public void testAnnotationBeginsAsMarker() throws Exception
-   {
-      Annotation anno = method.addAnnotation(Test.class);
-      assertTrue(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-
-      anno.setLiteralValue("\"Foo!\"");
-      assertFalse(anno.isMarker());
-      assertTrue(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-
-      anno.setStringValue("bar", "Foo!");
-      assertFalse(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertTrue(anno.isNormal());
-
-      assertEquals("\"Foo!\"", anno.getLiteralValue("bar"));
-      assertEquals("Foo!", anno.getStringValue("bar"));
-
-      anno.removeAllValues();
-      assertTrue(anno.isMarker());
-      assertFalse(anno.isSingleValue());
-      assertFalse(anno.isNormal());
-   }
-
-   @Test
-   public void testRemoveAllValues() throws Exception
-   {
-      method.addAnnotation(Test.class).setLiteralValue("expected", "RuntimeException.class");
-      method.applyChanges();
-
-      List<Annotation> annotations = method.getAnnotations();
-      Annotation annotation = annotations.get(annotations.size() - 1);
-      annotation.removeAllValues();
-
-      assertEquals(0, annotation.getValues().size());
-   }
 }



More information about the seam-commits mailing list