Author: mes
Date: 2010-09-24 12:29:47 -0700 (Fri, 24 Sep 2010)
New Revision: 22048

Added:
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AllFactoryTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskFactoryTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllNodesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedEdgesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedNodesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAdjacentEdgesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectConnectedNodesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFromFileListTaskTest.java
   core3/core-task-impl/trunk/src/test/resources/
   core3/core-task-impl/trunk/src/test/resources/bad_names.txt
   core3/core-task-impl/trunk/src/test/resources/empty.txt
   core3/core-task-impl/trunk/src/test/resources/node_names.txt
Modified:
   
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTask.java
   
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFromFileListTask.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AbstractSelectTaskTester.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllEdgesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllNodesTaskTest.java
   
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllTaskTest.java
Log:
added a bunch more unit tests

Modified: 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTask.java
===================================================================
--- 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTask.java
   2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTask.java
   2010-09-24 19:29:47 UTC (rev 22048)
@@ -54,9 +54,9 @@
 
        public void run(TaskMonitor tm) throws Exception {
                if ( nodeView == null )
-                       throw new Exception("node view is null");
+                       throw new NullPointerException("node view is null");
                if ( netView == null )
-                       throw new Exception("network view is null");
+                       throw new NullPointerException("network view is null");
 
                final Set<CyNode> selNodes = new HashSet<CyNode>();
                final CyNode node = nodeView.getModel();

Modified: 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFromFileListTask.java
===================================================================
--- 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFromFileListTask.java
     2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/select/SelectFromFileListTask.java
     2010-09-24 19:29:47 UTC (rev 22048)
@@ -65,7 +65,7 @@
        public void run(TaskMonitor tm) throws Exception {
 
                if ( file == null )
-                       throw new Exception("You must specify a file to load!");
+                       throw new NullPointerException("You must specify a file 
to load!");
 
                try {
                        FileReader fin = new FileReader(file);

Modified: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AbstractSelectTaskTester.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AbstractSelectTaskTester.java
   2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AbstractSelectTaskTester.java
   2010-09-24 19:29:47 UTC (rev 22048)
@@ -41,16 +41,62 @@
 import org.cytoscape.session.CyNetworkManager;
 import org.cytoscape.view.model.CyNetworkView;
 import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyRow;
 
+import java.util.List;
+import java.util.ArrayList;
+
 public class AbstractSelectTaskTester {
 
        CyNetworkManager netmgr;
        TaskMonitor tm;
+       CyNetwork net; 
+       CyRow r1;
+       CyEdge e1;
+       CyRow r2;
+       CyEdge e2;
+       CyRow r3;
+       CyNode e3;
+       CyRow r4;
+       CyNode e4;
 
        public void setUp() throws Exception {
                CyNetworkView view = mock(CyNetworkView.class);
+
                netmgr = mock(CyNetworkManager.class);
                when(netmgr.getNetworkView(anyLong())).thenReturn(view);
+
                tm = mock(TaskMonitor.class);
+
+               net = mock(CyNetwork.class);
+
+               r1 = mock(CyRow.class);
+               e1 = mock(CyEdge.class);
+               when(e1.attrs()).thenReturn(r1);
+
+               r2 = mock(CyRow.class);
+               e2 = mock(CyEdge.class);
+               when(e2.attrs()).thenReturn(r2);
+
+               List<CyEdge> el = new ArrayList<CyEdge>();
+               el.add(e1);
+               el.add(e2);
+               when(net.getEdgeList()).thenReturn(el);
+
+               r3 = mock(CyRow.class);
+               e3 = mock(CyNode.class);
+               when(e3.attrs()).thenReturn(r3);
+
+               r4 = mock(CyRow.class);
+               e4 = mock(CyNode.class);
+               when(e4.attrs()).thenReturn(r4);
+
+               List<CyNode> nl = new ArrayList<CyNode>();
+               nl.add(e3);
+               nl.add(e4);
+               when(net.getNodeList()).thenReturn(nl);
        }
 }

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AllFactoryTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AllFactoryTest.java
                             (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/AllFactoryTest.java
     2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,133 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.task.NetworkTaskFactory;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.Task;
+
+public class AllFactoryTest {
+
+       CyNetworkManager netmgr;
+       CyNetwork net;
+
+       @Before
+       public void setUp() throws Exception {
+               net = mock(CyNetwork.class);
+               netmgr = mock(CyNetworkManager.class);
+       }
+
+       @Test
+       public void testDeselectAllEdgesTaskFactory() {
+               executeTest( new DeselectAllEdgesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testDeselectAllNodesTaskFactory() {
+               executeTest( new DeselectAllNodesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testDeselectAllTaskFactory() {
+               executeTest( new DeselectAllTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testInvertSelectedEdgesTaskFactory() {
+               executeTest( new InvertSelectedEdgesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testInvertSelectedNodesTaskFactory() {
+               executeTest( new InvertSelectedNodesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectAdjacentEdgesTaskFactory() {
+               executeTest( new SelectAdjacentEdgesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectAllEdgesTaskFactory() {
+               executeTest( new SelectAllEdgesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectAllNodesTaskFactory() {
+               executeTest( new SelectAllNodesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectAllTaskFactory() {
+               executeTest( new SelectAllTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectConnectedNodesTaskFactory() {
+               executeTest( new SelectConnectedNodesTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectFirstNeighborsTaskFactory() {
+               executeTest( new SelectFirstNeighborsTaskFactory(netmgr) );
+       }
+
+       @Test
+       public void testSelectFromFileListTaskFactory() {
+               executeTest( new SelectFromFileListTaskFactory(netmgr) );
+       }
+
+
+       private void executeTest(NetworkTaskFactory ntf) {
+               ntf.setNetwork(net);
+               TaskIterator ti = ntf.getTaskIterator();
+               assertNotNull(ti);
+               assertTrue( ti.hasNext() );
+               Task t = ti.next();
+               assertNotNull( t );
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskFactoryTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskFactoryTest.java
                            (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskFactoryTest.java
    2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,74 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+
+public class DeselectAllEdgesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // run the task
+               Task t = new DeselectAllEdgesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r1, times(1)).set("selected",false);
+               verify(r2, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskTest.java
                           (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllEdgesTaskTest.java
   2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,74 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+
+public class DeselectAllEdgesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // run the task
+               Task t = new DeselectAllEdgesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r1, times(1)).set("selected",false);
+               verify(r2, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllNodesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllNodesTaskTest.java
                           (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllNodesTaskTest.java
   2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,74 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyNode;
+
+public class DeselectAllNodesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // run the task
+               Task t = new DeselectAllNodesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, times(1)).set("selected",false);
+               verify(r4, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllTaskTest.java
                                (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/DeselectAllTaskTest.java
        2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,77 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNode;
+
+public class DeselectAllTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // run the task
+               Task t = new DeselectAllTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r1, times(1)).set("selected",false);
+               verify(r2, times(1)).set("selected",false);
+               verify(r3, times(1)).set("selected",false);
+               verify(r4, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedEdgesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedEdgesTaskTest.java
                                (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedEdgesTaskTest.java
        2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,78 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+
+public class InvertSelectedEdgesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // more setup
+               when(r1.get("selected",Boolean.class)).thenReturn(false);       
+               when(r2.get("selected",Boolean.class)).thenReturn(true);        
+
+               // run the task
+               Task t = new InvertSelectedEdgesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r1, times(1)).set("selected",true);
+               verify(r2, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedNodesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedNodesTaskTest.java
                                (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/InvertSelectedNodesTaskTest.java
        2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,78 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyNode;
+
+public class InvertSelectedNodesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // more setup
+               when(r3.get("selected",Boolean.class)).thenReturn(false);       
+               when(r4.get("selected",Boolean.class)).thenReturn(true);        
+
+               // run the task
+               Task t = new InvertSelectedNodesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, times(1)).set("selected",true);
+               verify(r4, times(1)).set("selected",false);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAdjacentEdgesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAdjacentEdgesTaskTest.java
                                (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAdjacentEdgesTaskTest.java
        2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,80 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+
+public class SelectAdjacentEdgesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               when(r3.get("selected",Boolean.class)).thenReturn(true);
+               when(r4.get("selected",Boolean.class)).thenReturn(false);
+
+               List<CyEdge> el = new ArrayList<CyEdge>();
+               el.add(e1);
+               
when(net.getAdjacentEdgeList(e3,CyEdge.Type.ANY)).thenReturn(el);
+
+               // run the task
+               Task t = new SelectAdjacentEdgesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r1, times(1)).set("selected",true);
+       }
+}

Modified: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllEdgesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllEdgesTaskTest.java
     2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllEdgesTaskTest.java
     2010-09-24 19:29:47 UTC (rev 22048)
@@ -63,22 +63,6 @@
 
        @Test
        public void testRun() throws Exception {
-               // configure the mocks
-               CyNetwork net = mock(CyNetwork.class);
-
-               CyRow r1 = mock(CyRow.class);
-               CyEdge e1 = mock(CyEdge.class);
-               when(e1.attrs()).thenReturn(r1);
-
-               CyRow r2 = mock(CyRow.class);
-               CyEdge e2 = mock(CyEdge.class);
-               when(e2.attrs()).thenReturn(r2);
-
-               List<CyEdge> el = new ArrayList<CyEdge>();
-               el.add(e1);
-               el.add(e2);
-               when(net.getEdgeList()).thenReturn(el);
-
                // run the task
                Task t = new SelectAllEdgesTask(net,netmgr);
                t.run(tm);

Modified: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllNodesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllNodesTaskTest.java
     2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllNodesTaskTest.java
     2010-09-24 19:29:47 UTC (rev 22048)
@@ -63,28 +63,12 @@
 
        @Test
        public void testRun() throws Exception {
-               // configure the mocks
-               CyNetwork net = mock(CyNetwork.class);
-
-               CyRow r1 = mock(CyRow.class);
-               CyNode e1 = mock(CyNode.class);
-               when(e1.attrs()).thenReturn(r1);
-
-               CyRow r2 = mock(CyRow.class);
-               CyNode e2 = mock(CyNode.class);
-               when(e2.attrs()).thenReturn(r2);
-
-               List<CyNode> el = new ArrayList<CyNode>();
-               el.add(e1);
-               el.add(e2);
-               when(net.getNodeList()).thenReturn(el);
-
                // run the task
                Task t = new SelectAllNodesTask(net,netmgr);
                t.run(tm);
 
                // check that the expected rows were set
-               verify(r1, times(1)).set("selected",true);
-               verify(r2, times(1)).set("selected",true);
+               verify(r3, times(1)).set("selected",true);
+               verify(r4, times(1)).set("selected",true);
        }
 }

Modified: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllTaskTest.java
  2010-09-24 18:10:47 UTC (rev 22047)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectAllTaskTest.java
  2010-09-24 19:29:47 UTC (rev 22048)
@@ -64,36 +64,6 @@
 
        @Test
        public void testRun() throws Exception {
-               // configure the mocks
-               CyNetwork net = mock(CyNetwork.class);
-
-               CyRow r1 = mock(CyRow.class);
-               CyEdge e1 = mock(CyEdge.class);
-               when(e1.attrs()).thenReturn(r1);
-
-               CyRow r2 = mock(CyRow.class);
-               CyEdge e2 = mock(CyEdge.class);
-               when(e2.attrs()).thenReturn(r2);
-
-               List<CyEdge> el = new ArrayList<CyEdge>();
-               el.add(e1);
-               el.add(e2);
-               when(net.getEdgeList()).thenReturn(el);
-
-               CyRow r3 = mock(CyRow.class);
-               CyNode e3 = mock(CyNode.class);
-               when(e3.attrs()).thenReturn(r3);
-
-               CyRow r4 = mock(CyRow.class);
-               CyNode e4 = mock(CyNode.class);
-               when(e4.attrs()).thenReturn(r4);
-
-               List<CyNode> nl = new ArrayList<CyNode>();
-               nl.add(e3);
-               nl.add(e4);
-               when(net.getNodeList()).thenReturn(nl);
-
-
                // run the task
                Task t = new SelectAllTask(net,netmgr);
                t.run(tm);

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectConnectedNodesTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectConnectedNodesTaskTest.java
                               (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectConnectedNodesTaskTest.java
       2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,81 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+
+public class SelectConnectedNodesTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // more setup
+               when(r1.get("selected",Boolean.class)).thenReturn(true);        
+               when(r2.get("selected",Boolean.class)).thenReturn(false);       
+
+               when(e1.getSource()).thenReturn(e3);
+               when(e1.getTarget()).thenReturn(e4);
+
+               // run the task
+               Task t = new SelectConnectedNodesTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, times(1)).set("selected",true);
+               verify(r4, times(1)).set("selected",true);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTaskTest.java
                               (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsNodeViewTaskTest.java
       2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,103 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.CyNetworkView;
+
+public class SelectFirstNeighborsNodeViewTaskTest extends 
AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // more setup
+               List<CyNode> nl = new ArrayList<CyNode>();
+               nl.add(e4);
+               when(e3.getNeighborList(CyEdge.Type.ANY)).thenReturn(nl);
+
+               View<CyNode> nv = (View<CyNode>)mock(View.class);
+               when(nv.getModel()).thenReturn(e3);
+               CyNetworkView netView = mock(CyNetworkView.class);
+
+               // run the task
+               Task t = new SelectFirstNeighborsNodeViewTask(nv,netView);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r4, times(1)).set("selected",true);
+       }
+
+       @Test(expected=NullPointerException.class)
+       public void testNullNetworkView() throws Exception {
+               View<CyNode> nv = (View<CyNode>)mock(View.class);
+
+               // run the task
+               Task t = new SelectFirstNeighborsNodeViewTask(nv,null);
+               t.run(tm);
+       }
+
+       @Test(expected=NullPointerException.class)
+       public void testNullNodeView() throws Exception {
+               CyNetworkView netView = mock(CyNetworkView.class);
+
+               // run the task
+               Task t = new SelectFirstNeighborsNodeViewTask(null, netView);
+               t.run(tm);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsTaskTest.java
                               (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFirstNeighborsTaskTest.java
       2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,82 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyEdge;
+
+public class SelectFirstNeighborsTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+               // more setup
+               when(r3.get("selected",Boolean.class)).thenReturn(true);        
+               when(r4.get("selected",Boolean.class)).thenReturn(false);       
+
+               List<CyNode> nl = new ArrayList<CyNode>();
+               nl.add(e4);
+               when(net.getNeighborList(e3, CyEdge.Type.ANY)).thenReturn(nl);
+
+               // run the task
+               Task t = new SelectFirstNeighborsTask(net,netmgr);
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r4, times(1)).set("selected",true);
+       }
+}

Added: 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFromFileListTaskTest.java
===================================================================
--- 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFromFileListTaskTest.java
                         (rev 0)
+++ 
core3/core-task-impl/trunk/src/test/java/org/cytoscape/task/internal/select/SelectFromFileListTaskTest.java
 2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,122 @@
+/*
+  Copyright (c) 2010, 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.task.internal.select;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.cytoscape.session.CyNetworkManager;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.Task;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNode;
+
+import java.io.File;
+
+public class SelectFromFileListTaskTest extends AbstractSelectTaskTester {
+
+
+       @Before
+       public void setUp() throws Exception {
+               super.setUp();
+       }
+
+       @Test
+       public void testRun() throws Exception {
+
+               when(r3.get("name",String.class)).thenReturn("homer");
+               when(r4.get("name",String.class)).thenReturn("marge");
+
+               // run the task
+               SelectFromFileListTask t = new 
SelectFromFileListTask(net,netmgr);
+               t.file = new File("./src/test/resources/node_names.txt");
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, times(1)).set("selected",true);
+               verify(r4, times(1)).set("selected",true);
+       }
+
+       @Test(expected=NullPointerException.class)
+       public void testRunWithoutFileSpecified() throws Exception {
+               // run the task
+               SelectFromFileListTask t = new 
SelectFromFileListTask(net,netmgr);
+               t.run(tm);
+       }
+
+       @Test(expected=Exception.class)
+       public void testNonExistantFile() throws Exception {
+               // run the task
+               SelectFromFileListTask t = new 
SelectFromFileListTask(net,netmgr);
+               t.file = new File("./src/test/resources/does-not-exist.txt");
+               t.run(tm);
+       }
+
+       @Test
+       public void testRunEmptyFile() throws Exception {
+               // run the task
+               SelectFromFileListTask t = new 
SelectFromFileListTask(net,netmgr);
+               t.file = new File("./src/test/resources/empty.txt");
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, never()).set("selected",true);
+               verify(r4, never()).set("selected",true);
+       }
+
+       @Test
+       public void testRunNamesDontMatch() throws Exception {
+               // run the task
+               SelectFromFileListTask t = new 
SelectFromFileListTask(net,netmgr);
+               t.file = new File("./src/test/resources/bad_names.txt");
+               t.run(tm);
+
+               // check that the expected rows were set
+               verify(r3, never()).set("selected",true);
+               verify(r4, never()).set("selected",true);
+       }
+
+}

Added: core3/core-task-impl/trunk/src/test/resources/bad_names.txt
===================================================================
--- core3/core-task-impl/trunk/src/test/resources/bad_names.txt                 
        (rev 0)
+++ core3/core-task-impl/trunk/src/test/resources/bad_names.txt 2010-09-24 
19:29:47 UTC (rev 22048)
@@ -0,0 +1,5 @@
+bart
+lisa
+maggie
+
+

Added: core3/core-task-impl/trunk/src/test/resources/empty.txt
===================================================================
Added: core3/core-task-impl/trunk/src/test/resources/node_names.txt
===================================================================
--- core3/core-task-impl/trunk/src/test/resources/node_names.txt                
                (rev 0)
+++ core3/core-task-impl/trunk/src/test/resources/node_names.txt        
2010-09-24 19:29:47 UTC (rev 22048)
@@ -0,0 +1,2 @@
+homer
+marge

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