1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
package net.sourceforge.combean.test.graph.iterators; |
23 | |
|
24 | |
import junit.framework.TestCase; |
25 | |
import net.sourceforge.combean.graph.iterators.IndexedNodeIterator; |
26 | |
import net.sourceforge.combean.interfaces.graph.prop.GlobalIndexedNodesGraphProp; |
27 | |
import net.sourceforge.combean.samples.simplegraphs.IsolatedNodes; |
28 | |
import net.sourceforge.combean.test.helpers.checks.CheckGraph; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
public class TestIndexedNodeIterator extends TestCase { |
35 | |
|
36 | 3 | private GlobalIndexedNodesGraphProp emptyGraph = null; |
37 | 3 | private GlobalIndexedNodesGraphProp graph = null; |
38 | |
private static final int NUMNODES = 4; |
39 | |
|
40 | 3 | private IndexedNodeIterator nodeItOnEmptyGraph = null; |
41 | 3 | private IndexedNodeIterator nodeIt = null; |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
protected void setUp() throws Exception { |
47 | 3 | super.setUp(); |
48 | |
|
49 | 3 | this.emptyGraph = new IsolatedNodes(0); |
50 | 3 | this.nodeItOnEmptyGraph = new IndexedNodeIterator(this.emptyGraph); |
51 | 3 | this.graph = new IsolatedNodes(NUMNODES); |
52 | 3 | this.nodeIt = new IndexedNodeIterator(this.graph); |
53 | 3 | } |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
protected void tearDown() throws Exception { |
59 | 3 | super.tearDown(); |
60 | 3 | } |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
public TestIndexedNodeIterator(String name) { |
67 | 3 | super(name); |
68 | 3 | } |
69 | |
|
70 | |
public final void testIteration() { |
71 | 3 | assertFalse(this.nodeItOnEmptyGraph.hasNext()); |
72 | |
|
73 | 3 | CheckGraph.checkNumIterations(this.nodeIt, NUMNODES); |
74 | 3 | } |
75 | |
|
76 | |
} |