01: package test;
02:
03: import java.util.HashMap;
04: import java.util.Iterator;
05: import java.util.Map;
06:
07: public class BaseDistributedTest {
08: private boolean m_verbose = false;
09:
10: protected void verifyTests(String title, String[] exp, Map found) {
11: Map expected = new HashMap();
12: for (int i = 0; i < exp.length; i++) {
13: expected.put(exp[i], exp[i]);
14: }
15:
16: assert expected.size() == found.size() : "Expected "
17: + expected.size() + " " + title + " tests but found "
18: + found.size();
19:
20: for (Iterator it = expected.values().iterator(); it.hasNext();) {
21: String name = (String) it.next();
22: if (null == found.get(name)) {
23: dumpMap("Expected", expected);
24: dumpMap("Found", found);
25: }
26: assert null != found.get(name) : "Expected to find method "
27: + name + " in " + title + " but didn't find it.";
28: }
29: }
30:
31: protected void dumpMap(String title, Map m) {
32: if (m_verbose) {
33: System.out.println("==== " + title);
34: for (Iterator it = m.keySet().iterator(); it.hasNext();) {
35: Object key = it.next();
36: Object value = m.get(key);
37: ppp(key + " => " + value);
38: }
39: }
40: }
41:
42: private void ppp(String s) {
43: if (m_verbose) {
44: System.out.println("[BaseDistributedTest] " + s);
45: }
46: }
47:
48: }
|