Author: mes
Date: 2010-09-01 14:55:20 -0700 (Wed, 01 Sep 2010)
New Revision: 21656
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractDataTableTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractEdgeViewTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkCollectionTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewCollectionTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNodeViewTaskFactoryTest.java
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractRowTaskFactoryTest.java
Removed:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractCyDataTableMapperTaskFactory.java
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/CyDataTableMapperTaskFactory.java
Modified:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractDataTableTaskFactory.java
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractEdgeViewTaskFactory.java
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractNetworkTaskFactory.java
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractRowTaskFactory.java
Log:
added tests for abstract factories
Deleted:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractCyDataTableMapperTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractCyDataTableMapperTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractCyDataTableMapperTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -1,62 +0,0 @@
-/*
- File: AbstractCyDataTableMapperTaskFactory.java
-
- 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.task;
-
-
-import org.cytoscape.model.CyDataTable;
-import org.cytoscape.work.Task;
-
-
-public abstract class AbstractCyDataTableMapperTaskFactory implements
CyDataTableMapperTaskFactory {
- protected CyDataTable source;
- protected String sourceColumn;
- protected CyDataTable target;
- protected String targetColumn;
-
- public void setSourceAndTarget(CyDataTable source, String sourceColumn,
CyDataTable target, String targetColumn) {
- if (source == null)
- throw new IllegalArgumentException("\"source\" is
null!");
- this.source = source;
-
- if (sourceColumn == null)
- throw new IllegalArgumentException("\"sourceColumn\" is
null!");
- this.sourceColumn = sourceColumn;
-
- if (target == null)
- throw new IllegalArgumentException("\"target\" is
null!");
- this.target = target;
-
- if (targetColumn == null)
- throw new IllegalArgumentException("\"targetColumn\" is
null!");
- this.targetColumn = targetColumn;
- }
-
- public abstract Task getTask();
-}
Modified:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractDataTableTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractDataTableTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractDataTableTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -50,5 +50,4 @@
this.table = table;
}
- public abstract Task getTask();
}
Modified:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractEdgeViewTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractEdgeViewTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractEdgeViewTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -56,5 +56,4 @@
this.netView = netView;
}
- public abstract Task getTask();
}
Modified:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractNetworkTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractNetworkTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractNetworkTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -39,7 +39,7 @@
public void setNetwork(final CyNetwork net) {
if (net == null)
- throw new IllegalArgumentException("\"net\" is null!");
+ throw new NullPointerException("\"net\" is null!");
this.net = net;
}
}
Modified:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractRowTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractRowTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/AbstractRowTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -50,5 +50,4 @@
this.row = row;
}
- public abstract Task getTask();
}
Deleted:
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/CyDataTableMapperTaskFactory.java
===================================================================
---
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/CyDataTableMapperTaskFactory.java
2010-09-01 21:13:09 UTC (rev 21655)
+++
core3/core-task-api/trunk/src/main/java/org/cytoscape/task/CyDataTableMapperTaskFactory.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -1,10 +0,0 @@
-package org.cytoscape.task;
-
-
-import org.cytoscape.model.CyDataTable;
-import org.cytoscape.work.TaskFactory;
-
-
-public interface CyDataTableMapperTaskFactory extends TaskFactory {
- public void setSourceAndTarget(CyDataTable source, String sourceColumn,
CyDataTable target, String targetColumn);
-}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractDataTableTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractDataTableTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractDataTableTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -0,0 +1,83 @@
+/*
+ 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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.model.CyDataTableFactory;
+import org.cytoscape.model.CyDataTable;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractDataTableTaskFactoryTest {
+
+ private class DataTableTaskFactory extends AbstractDataTableTaskFactory
{
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ DataTableTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new DataTableTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetDataTable() throws Exception {
+ factory.setDataTable(null);
+ }
+
+ @Test
+ public void testGoodSetDataTable() throws Exception {
+ factory.setDataTable(mock(CyDataTable.class));
+ assertNotNull( factory.table );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+ factory.setDataTable(mock(CyDataTable.class));
+ CyDataTable t1 = factory.table;
+ factory.setDataTable(mock(CyDataTable.class));
+ CyDataTable t2 = factory.table;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractEdgeViewTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractEdgeViewTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractEdgeViewTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -0,0 +1,99 @@
+/*
+ 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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.model.CyEdge;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractEdgeViewTaskFactoryTest {
+
+ private class EdgeViewTaskFactory extends AbstractEdgeViewTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ EdgeViewTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new EdgeViewTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetEdgeView() throws Exception {
+ factory.setEdgeView(null,mock(CyNetworkView.class));
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetworkView() throws Exception {
+ factory.setEdgeView((View<CyEdge>)mock(View.class),null);
+ }
+
+ @Test
+ public void testGoodSetEdgeView() throws Exception {
+
factory.setEdgeView((View<CyEdge>)mock(View.class),mock(CyNetworkView.class));
+ assertNotNull( factory.edgeView );
+ assertNotNull( factory.netView );
+ }
+
+ @Test
+ public void testEdgeViewNotFinal() throws Exception {
+
factory.setEdgeView((View<CyEdge>)mock(View.class),mock(CyNetworkView.class));
+ View<CyEdge> t1 = factory.edgeView;
+
factory.setEdgeView((View<CyEdge>)mock(View.class),mock(CyNetworkView.class));
+ View<CyEdge> t2 = factory.edgeView;
+ assertFalse( (t1 == t2) );
+ }
+
+ @Test
+ public void testNetworkViewNotFinal() throws Exception {
+
factory.setEdgeView((View<CyEdge>)mock(View.class),mock(CyNetworkView.class));
+ CyNetworkView t1 = factory.netView;
+
factory.setEdgeView((View<CyEdge>)mock(View.class),mock(CyNetworkView.class));
+ CyNetworkView t2 = factory.netView;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkCollectionTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkCollectionTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkCollectionTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -0,0 +1,84 @@
+/*
+ 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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.model.CyNetwork;
+
+import org.cytoscape.work.TaskIterator;
+
+import java.util.Collection;
+
+public class AbstractNetworkCollectionTaskFactoryTest {
+
+ private class NetworkCollectionTaskFactory extends
AbstractNetworkCollectionTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ NetworkCollectionTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new NetworkCollectionTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetworkCollection() throws Exception {
+ factory.setNetworkCollection(null);
+ }
+
+ @Test
+ public void testGoodSetNetworkCollection() throws Exception {
+
factory.setNetworkCollection((Collection<CyNetwork>)mock(Collection.class));
+ assertNotNull( factory.networks );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+
factory.setNetworkCollection((Collection<CyNetwork>)mock(Collection.class));
+ Collection<CyNetwork> t1 = factory.networks;
+
factory.setNetworkCollection((Collection<CyNetwork>)mock(Collection.class));
+ Collection<CyNetwork> t2 = factory.networks;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.model.CyNetwork;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractNetworkTaskFactoryTest {
+
+ private class NetworkTaskFactory extends AbstractNetworkTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ NetworkTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new NetworkTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetwork() throws Exception {
+ factory.setNetwork(null);
+ }
+
+ @Test
+ public void testGoodSetNetwork() throws Exception {
+ factory.setNetwork(mock(CyNetwork.class));
+ assertNotNull( factory.net );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+ factory.setNetwork(mock(CyNetwork.class));
+ CyNetwork t1 = factory.net;
+ factory.setNetwork(mock(CyNetwork.class));
+ CyNetwork t2 = factory.net;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewCollectionTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewCollectionTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewCollectionTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -0,0 +1,84 @@
+/*
+ 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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.view.model.CyNetworkView;
+
+import org.cytoscape.work.TaskIterator;
+
+import java.util.Collection;
+
+public class AbstractNetworkViewCollectionTaskFactoryTest {
+
+ private class NetworkViewCollectionTaskFactory extends
AbstractNetworkViewCollectionTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ NetworkViewCollectionTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new NetworkViewCollectionTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetworkViewCollection() throws Exception {
+ factory.setNetworkViewCollection(null);
+ }
+
+ @Test
+ public void testGoodSetNetworkViewCollection() throws Exception {
+
factory.setNetworkViewCollection((Collection<CyNetworkView>)mock(Collection.class));
+ assertNotNull( factory.networkViews );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+
factory.setNetworkViewCollection((Collection<CyNetworkView>)mock(Collection.class));
+ Collection<CyNetworkView> t1 = factory.networkViews;
+
factory.setNetworkViewCollection((Collection<CyNetworkView>)mock(Collection.class));
+ Collection<CyNetworkView> t2 = factory.networkViews;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNetworkViewTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.view.model.CyNetworkView;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractNetworkViewTaskFactoryTest {
+
+ private class NetworkViewTaskFactory extends
AbstractNetworkViewTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ NetworkViewTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new NetworkViewTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetworkView() throws Exception {
+ factory.setNetworkView(null);
+ }
+
+ @Test
+ public void testGoodSetNetworkView() throws Exception {
+ factory.setNetworkView(mock(CyNetworkView.class));
+ assertNotNull( factory.view );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+ factory.setNetworkView(mock(CyNetworkView.class));
+ CyNetworkView t1 = factory.view;
+ factory.setNetworkView(mock(CyNetworkView.class));
+ CyNetworkView t2 = factory.view;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNodeViewTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNodeViewTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractNodeViewTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -0,0 +1,99 @@
+/*
+ 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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.model.CyNode;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractNodeViewTaskFactoryTest {
+
+ private class NodeViewTaskFactory extends AbstractNodeViewTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ NodeViewTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new NodeViewTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNodeView() throws Exception {
+ factory.setNodeView(null,mock(CyNetworkView.class));
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetNetworkView() throws Exception {
+ factory.setNodeView((View<CyNode>)mock(View.class),null);
+ }
+
+ @Test
+ public void testGoodSetNodeView() throws Exception {
+
factory.setNodeView((View<CyNode>)mock(View.class),mock(CyNetworkView.class));
+ assertNotNull( factory.nodeView );
+ assertNotNull( factory.netView );
+ }
+
+ @Test
+ public void testNodeViewNotFinal() throws Exception {
+
factory.setNodeView((View<CyNode>)mock(View.class),mock(CyNetworkView.class));
+ View<CyNode> t1 = factory.nodeView;
+
factory.setNodeView((View<CyNode>)mock(View.class),mock(CyNetworkView.class));
+ View<CyNode> t2 = factory.nodeView;
+ assertFalse( (t1 == t2) );
+ }
+
+ @Test
+ public void testNetworkViewNotFinal() throws Exception {
+
factory.setNodeView((View<CyNode>)mock(View.class),mock(CyNetworkView.class));
+ CyNetworkView t1 = factory.netView;
+
factory.setNodeView((View<CyNode>)mock(View.class),mock(CyNetworkView.class));
+ CyNetworkView t2 = factory.netView;
+ assertFalse( (t1 == t2) );
+ }
+}
Added:
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractRowTaskFactoryTest.java
===================================================================
---
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractRowTaskFactoryTest.java
(rev 0)
+++
core3/core-task-api/trunk/src/test/java/org/cytoscape/task/AbstractRowTaskFactoryTest.java
2010-09-01 21:55:20 UTC (rev 21656)
@@ -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;
+
+import static org.mockito.Mockito.*;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.Before;
+
+import org.cytoscape.model.CyRow;
+
+import org.cytoscape.work.TaskIterator;
+
+public class AbstractRowTaskFactoryTest {
+
+ private class RowTaskFactory extends AbstractRowTaskFactory {
+ public TaskIterator getTaskIterator() {
+ return null;
+ }
+ }
+
+ RowTaskFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new RowTaskFactory();
+ }
+
+ @Test(expected=NullPointerException.class)
+ public void testNullSetRow() throws Exception {
+ factory.setRow(null);
+ }
+
+ @Test
+ public void testGoodSetRow() throws Exception {
+ factory.setRow(mock(CyRow.class));
+ assertNotNull( factory.row );
+ }
+
+ @Test
+ public void testNotFinal() throws Exception {
+ factory.setRow(mock(CyRow.class));
+ CyRow t1 = factory.row;
+ factory.setRow(mock(CyRow.class));
+ CyRow t2 = factory.row;
+ assertFalse( (t1 == t2) );
+ }
+}
--
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.