Author: ruschein
Date: 2011-01-14 12:25:56 -0800 (Fri, 14 Jan 2011)
New Revision: 23463
Added:
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/AbstractTableEventTest.java
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetAboutToBeChangedEventTest.java
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetChangedEventTest.java
Log:
Added tests for the newly added event types.
Copied:
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/AbstractTableEventTest.java
(from rev 23461,
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/AbstractNetworkEventTest.java)
===================================================================
---
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/AbstractTableEventTest.java
(rev 0)
+++
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/AbstractTableEventTest.java
2011-01-14 20:25:56 UTC (rev 23463)
@@ -0,0 +1,31 @@
+package org.cytoscape.model.events;
+
+
+import org.cytoscape.model.CyTable;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+import static org.mockito.Mockito.*;
+
+
+public class AbstractTableEventTest {
+ @Test
+ public final void testGetTable() {
+ final CyTable table = mock(CyTable.class);
+ final AbstractTableEvent event = new AbstractTableEvent(this,
Object.class, table);
+ assertEquals("Table returned by getTable() is *not* the one
passed into the constructor!",
+ table, event.getTable());
+ }
+
+ @Test
+ public final void testNullTableConstructorFailure() {
+ try {
+ final AbstractTableEvent event = new
AbstractTableEvent(this, Object.class, null);
+ } catch (final NullPointerException e) {
+ return;
+ }
+
+ fail("The expected NullPointerException was *not* triggered!");
+ }
+}
\ No newline at end of file
Copied:
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetAboutToBeChangedEventTest.java
(from rev 23461,
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RemovedEdgeEventTest.java)
===================================================================
---
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetAboutToBeChangedEventTest.java
(rev 0)
+++
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetAboutToBeChangedEventTest.java
2011-01-14 20:25:56 UTC (rev 23463)
@@ -0,0 +1,69 @@
+/*
+ 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.model.events;
+
+
+import org.cytoscape.model.CyTable;
+
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.*;
+
+
+public class RowSetAboutToBeChangedEventTest extends AbstractTableEventTest {
+ private RowSetAboutToBeChangedEvent event;
+
+ @Before
+ public void setUp() {
+ final CyTable table = mock(CyTable.class);
+ event = new RowSetAboutToBeChangedEvent(this, table);
+ }
+
+ @Test
+ public void testGetSource() {
+ assertEquals("getSource() did *not* return the expected
source!",
+ event.getSource(), this);
+ }
+
+ @Test
+ public void testGetListenerClass() {
+ assertEquals("getListenerClass() did *not* return the expected
class!",
+ event.getListenerClass(),
RowSetAboutToBeChangedListener.class);
+ }
+
+ public void testNullTable() {
+ try {
+ RemovedEdgeEvent ev = new RemovedEdgeEvent(null);
+ } catch (NullPointerException npe) {
+ return;
+ }
+ fail("didn't catch expected npe for tablework");
+ }
+}
Copied:
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetChangedEventTest.java
(from rev 23461,
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RemovedEdgeEventTest.java)
===================================================================
---
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetChangedEventTest.java
(rev 0)
+++
core3/model-api/trunk/src/test/java/org/cytoscape/model/events/RowSetChangedEventTest.java
2011-01-14 20:25:56 UTC (rev 23463)
@@ -0,0 +1,69 @@
+/*
+ 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.model.events;
+
+
+import org.cytoscape.model.CyTable;
+
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.*;
+
+
+public class RowSetChangedEventTest extends AbstractTableEventTest {
+ private RowSetChangedEvent event;
+
+ @Before
+ public void setUp() {
+ final CyTable table = mock(CyTable.class);
+ event = new RowSetChangedEvent(this, table);
+ }
+
+ @Test
+ public void testGetSource() {
+ assertEquals("getSource() did *not* return the expected
source!",
+ event.getSource(), this);
+ }
+
+ @Test
+ public void testGetListenerClass() {
+ assertEquals("getListenerClass() did *not* return the expected
class!",
+ event.getListenerClass(),
RowSetChangedListener.class);
+ }
+
+ public void testNullTable() {
+ try {
+ RemovedEdgeEvent ev = new RemovedEdgeEvent(null);
+ } catch (NullPointerException npe) {
+ return;
+ }
+ fail("didn't catch expected npe for tablework");
+ }
+}
--
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.