Author: mes
Date: 2010-08-31 16:42:10 -0700 (Tue, 31 Aug 2010)
New Revision: 21647

Added:
   core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyEvent.java
   core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyListener.java
Modified:
   
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
Log:
more unit tests

Modified: 
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
===================================================================
--- 
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
      2010-08-31 23:35:56 UTC (rev 21646)
+++ 
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
      2010-08-31 23:42:10 UTC (rev 21647)
@@ -59,8 +59,7 @@
         *  DOCUMENT ME!
         */
        public void testSynchronous() {
-               // TODO figure out why I need to cast the StubCyEvent
-               helper.fireSynchronousEvent((StubCyEvent) new 
StubCyEvent("homer"));
+               helper.fireSynchronousEvent(new StubCyEvent("homer"));
                assertEquals(1, service.getNumCalls());
        }
 
@@ -69,8 +68,7 @@
         */
        public void testAsynchronous() {
                try {
-                       // TODO figure out why I need to cast the StubCyEvent
-                       helper.fireAsynchronousEvent((StubCyEvent) new 
StubCyEvent("marge"));
+                       helper.fireAsynchronousEvent(new StubCyEvent("marge"));
                        Thread.sleep(500); // TODO is there a better way to 
wait?
                        assertEquals(1, service.getNumCalls());
                } catch (InterruptedException ie) {
@@ -179,4 +177,18 @@
                assertEquals("number of calls", 2,stub1.getNumCalls());
                assertEquals("value of event", 10,stub1.getEventValue());
        }
+
+       public void testSynchronousNoInstances() {
+               helper.fireSynchronousEvent(new FakeCyEvent());
+       }
+
+       public void testAsynchronousNoInstances() {
+               try {
+                       helper.fireAsynchronousEvent(new FakeCyEvent());
+                       Thread.sleep(500); // TODO is there a better way to 
wait?
+               } catch (InterruptedException ie) {
+                       ie.printStackTrace();
+                       fail();
+               }
+       }
 }

Added: core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyEvent.java
===================================================================
--- core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyEvent.java    
                        (rev 0)
+++ core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyEvent.java    
2010-08-31 23:42:10 UTC (rev 21647)
@@ -0,0 +1,43 @@
+
+/*
+ Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ 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.event;
+
+public class FakeCyEvent extends AbstractCyEvent<Object> {
+       public FakeCyEvent() {
+               super(new Object(), FakeCyListener.class);
+       }
+}      

Added: 
core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyListener.java
===================================================================
--- core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyListener.java 
                        (rev 0)
+++ core3/event-api/trunk/src/test/java/org/cytoscape/event/FakeCyListener.java 
2010-08-31 23:42:10 UTC (rev 21647)
@@ -0,0 +1,42 @@
+
+/*
+ Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ 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.event;
+
+public interface FakeCyListener extends CyListener {
+       void handleEvent(FakeCyEvent e);
+}
+

-- 
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