use of org.cytoscape.task.internal.export.network.LoadNetworkURLTask in project cytoscape-impl by cytoscape.
the class LoadNetworkURLTaskTest method testNullURL.
@Test(expected = NullPointerException.class)
public void testNullURL() throws Exception {
TaskFactory factory = new LoadNetworkURLTaskFactoryImpl(serviceRegistrar);
TaskIterator ti = factory.createTaskIterator();
TaskMonitor tm = mock(TaskMonitor.class);
boolean first = true;
while (ti.hasNext()) {
Task t = ti.next();
if (first) {
((LoadNetworkURLTask) t).url = null;
first = false;
}
t.run(tm);
}
}
use of org.cytoscape.task.internal.export.network.LoadNetworkURLTask in project cytoscape-impl by cytoscape.
the class LoadNetworkURLTaskTest method testRun.
@Test
public void testRun() throws Exception {
TaskFactory factory = new LoadNetworkURLTaskFactoryImpl(serviceRegistrar);
assertNotNull(netViewManager);
TaskIterator ti = factory.createTaskIterator();
TaskMonitor tm = mock(TaskMonitor.class);
boolean first = true;
while (ti.hasNext()) {
Task t = ti.next();
if (first) {
((LoadNetworkURLTask) t).url = url;
first = false;
}
t.run(tm);
}
verify(netManager).addNetwork(net, false);
// verify(networkViewManager).addNetworkView(view);
verify(tm, atLeast(1)).setProgress(1.0);
}
use of org.cytoscape.task.internal.export.network.LoadNetworkURLTask in project cytoscape-impl by cytoscape.
the class LoadNetworkURLTaskTest method testBadConnection.
@Test(expected = Exception.class)
public void testBadConnection() throws Exception {
doThrow(new IOException("bad connection")).when(connection).connect();
TaskFactory factory = new LoadNetworkURLTaskFactoryImpl(serviceRegistrar);
TaskIterator ti = factory.createTaskIterator();
TaskMonitor tm = mock(TaskMonitor.class);
boolean first = true;
while (ti.hasNext()) {
Task t = ti.next();
if (first) {
((LoadNetworkURLTask) t).url = url;
first = false;
}
t.run(tm);
}
}
Aggregations