Author: ruschein
Date: 2010-10-19 12:51:47 -0700 (Tue, 19 Oct 2010)
New Revision: 22292

Added:
   core3/work-swing-api/trunk/src/test/
   core3/work-swing-api/trunk/src/test/java/
   core3/work-swing-api/trunk/src/test/java/org/
   core3/work-swing-api/trunk/src/test/java/org/cytoscape/
   core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/
   core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/
   
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/AbstractGUITunableHandlerTest.java
   
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/HasAnnotatedField.java
Modified:
   core3/work-swing-api/trunk/pom.xml
Log:
Added a small amount of testing and code coverage.

Modified: core3/work-swing-api/trunk/pom.xml
===================================================================
--- core3/work-swing-api/trunk/pom.xml  2010-10-19 18:04:38 UTC (rev 22291)
+++ core3/work-swing-api/trunk/pom.xml  2010-10-19 19:51:47 UTC (rev 22292)
@@ -107,9 +107,19 @@
                                        </instructions>
                                </configuration>
                        </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>test-jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
                </plugins>
        </build>
-
        <dependencies>
                <dependency>
                        <groupId>org.cytoscape</groupId>
@@ -131,6 +141,11 @@
                        <artifactId>pax-logging-api</artifactId>
                        <version>1.5.2</version>
                </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>${junit.version}</version>
+                       <scope>test</scope>
+               </dependency>
        </dependencies>
-
 </project>

Added: 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/AbstractGUITunableHandlerTest.java
===================================================================
--- 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/AbstractGUITunableHandlerTest.java
                                (rev 0)
+++ 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/AbstractGUITunableHandlerTest.java
        2010-10-19 19:51:47 UTC (rev 22292)
@@ -0,0 +1,59 @@
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library 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
+ any later version.
+
+ This library 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.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  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 library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.work.swing;
+
+
+import java.lang.reflect.Field;
+
+import org.cytoscape.work.Tunable;
+
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+
+
+public class AbstractGUITunableHandlerTest {
+       private static class SimpleGUITunableHandler extends 
AbstractGUITunableHandler {
+               SimpleGUITunableHandler(final Field field, final Object 
instance, final Tunable tunable) {
+                       super(field, instance, tunable);
+               }
+
+               public void handle() {
+               }
+       }
+
+       @Test
+       public void testConstructor() throws Exception {
+               final HasAnnotatedField hasAnnotatedField = new 
HasAnnotatedField();
+               final Field annotatedIntField = 
hasAnnotatedField.getClass().getField("annotatedInt");
+               final Tunable annotatedIntTunable = 
annotatedIntField.getAnnotation(Tunable.class);
+
+               final SimpleGUITunableHandler handler = new 
SimpleGUITunableHandler(annotatedIntField, hasAnnotatedField, 
annotatedIntTunable);
+               assertEquals("Unexpected return value from getState()!", "42", 
handler.getState());
+       }
+}

Copied: 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/HasAnnotatedField.java
 (from rev 22283, 
core3/work-api/trunk/src/test/java/org/cytoscape/work/HasAnnotatedField.java)
===================================================================
--- 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/HasAnnotatedField.java
                            (rev 0)
+++ 
core3/work-swing-api/trunk/src/test/java/org/cytoscape/work/swing/HasAnnotatedField.java
    2010-10-19 19:51:47 UTC (rev 22292)
@@ -0,0 +1,40 @@
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library 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
+ any later version.
+
+ This library 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.  The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications.  In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage.  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 library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.work.swing;
+
+
+import org.cytoscape.work.Tunable;
+
+
+public class HasAnnotatedField {
+       @Tunable(description="An annotated field", groups={"group1"},
+                
params="input=true;alignments=horizontal;displayState=uncollapsed;groupTitles=hidden,displayed")
+       public int annotatedInt = 42;
+
+       public int getAnnotatedInt() { return annotatedInt; }
+}

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to