Author: ruschein
Date: 2010-10-18 15:41:41 -0700 (Mon, 18 Oct 2010)
New Revision: 22279
Modified:
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskTest.java
Log:
Increased test coverage.
Modified:
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
===================================================================
---
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2010-10-18 22:36:38 UTC (rev 22278)
+++
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2010-10-18 22:41:41 UTC (rev 22279)
@@ -31,6 +31,7 @@
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
+
import static org.mockito.Mockito.*;
@@ -48,6 +49,20 @@
}
}
+ static private class SimpleTunableInterceptor<TH extends
TunableHandler> extends AbstractTunableInterceptor {
+ SimpleTunableInterceptor(HandlerFactory<TH>
tunableHandlerFactory) {
+ super(tunableHandlerFactory);
+ }
+
+ public boolean execUI(Object... obs) {
+ return false;
+ }
+
+ public boolean validateAndWriteBackTunables(Object... objs) {
+ return false;
+ }
+ }
+
@Test
public void testConstructor() {
final TunableInterceptor interceptor =
mock(TunableInterceptor.class);
@@ -55,4 +70,16 @@
assertEquals("The TunableInterceptor passed into the
TaskMananger's constructor is not that same as that of the protected data
members!",
interceptor, taskManager.getTunableInterceptor());
}
+
+ @Test
+ public void testHasTunables() {
+ final HandlerFactory<SimpleTunableHandler> handlerFactory=
mock(HandlerFactory.class);
+ final TunableInterceptor interceptor = new
SimpleTunableInterceptor<SimpleTunableHandler>(handlerFactory);
+ final SimpleTaskMananger taskManager = new
SimpleTaskMananger(interceptor);
+ assertFalse("This object has *no* Tunable annotation!",
taskManager.hasTunables(new Object()));
+ assertTrue("This object has an annotated field!",
+ taskManager.hasTunables(new HasAnnotatedField()));
+ assertTrue("This object has annotated getter/setter methods!",
+ taskManager.hasTunables(new
HasAnnotatedSetterAndGetterMethods()));
+ }
}
\ No newline at end of file
Modified:
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskTest.java
===================================================================
--- core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskTest.java
2010-10-18 22:36:38 UTC (rev 22278)
+++ core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskTest.java
2010-10-18 22:41:41 UTC (rev 22279)
@@ -56,6 +56,14 @@
}
assertFalse("Invalid task count in iterator!", iter.hasNext());
}
+
+ @Test
+ public final void testCancellation() throws Exception {
+ final SimpleTask2 task = new SimpleTask2(1);
+ assertFalse("\"cancelled\" must start out set to false!",
task.cancelled());
+ task.cancel();
+ assertTrue("\"cancelled\" must be true after a call to
cancel()!", task.cancelled());
+ }
}
@@ -74,11 +82,7 @@
// Intentionally do nothing!
}
- public void cancel() {
- // Intentionally do nothing!
- }
-
public boolean cancelled() {
- return false;
+ return this.cancelled;
}
}
\ No newline at end of file
--
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.