1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.dbunit.util.search;
23
24 import java.util.SortedSet;
25
26
27
28
29
30
31
32 public class IncludeNodesSearchCallbackTest extends AbstractSearchTestCase {
33
34 private ISearchCallback callback;
35
36 protected ISearchCallback getCallback() {
37 return this.callback;
38 }
39
40 protected void setAllowed( Object[] allowedNodes ) {
41 this.callback = new AbstractIncludeNodesSearchCallback( allowedNodes ) {
42
43 public SortedSet getEdges(Object fromNode) throws SearchException {
44 return getEdgesFromNode(fromNode);
45 }
46 };
47
48 }
49
50 public void testSingleNode() throws Exception {
51 setInput(new String[] { A });
52 setAllowed( new String[] { A } );
53 setOutput(new String[] { A });
54 doIt();
55 }
56
57 public void testSingleEdgeAllowedA() throws Exception {
58 setInput(new String[] { A });
59 addEdges(A, new String[] { B });
60 setAllowed( new String[] { A } );
61 setOutput(new String[] { A });
62 doIt();
63 }
64
65 public void testSingleEdgeAllowedB() throws Exception {
66 setInput(new String[] { A });
67 addEdges(A, new String[] { B });
68 setAllowed( new String[] { B } );
69 doIt();
70 }
71 public void testSingleEdgeMultipleInputAllowedB() throws Exception {
72 setInput(new String[] { A, B });
73 addEdges(A, new String[] { B });
74 setAllowed( new String[] { B } );
75 setOutput(new String[] { B });
76 doIt();
77 }
78
79 public void testDisconnected() throws Exception {
80 setInput(new String[] { A, C });
81 addEdges(A, new String[] { B });
82 setAllowed( new String[] { B, A } );
83 setOutput(new String[] { B, A });
84 doIt();
85 }
86
87 public void testDisconnectedAllowedC() throws Exception {
88 setInput(new String[] { A, C });
89 addEdges(A, new String[] { B });
90 setAllowed( new String[] { C } );
91 setOutput(new String[] { C });
92 doIt();
93 }
94
95
96 }