01: /*
02: * Copyright (c) 2001-2007, Jean Tessier
03: * All rights reserved.
04: *
05: * Redistribution and use in source and binary forms, with or without
06: * modification, are permitted provided that the following conditions
07: * are met:
08: *
09: * * Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: *
12: * * Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: *
16: * * Neither the name of Jean Tessier nor the names of his contributors
17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
24: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31: */
32:
33: package com.jeantessier.dependencyfinder.web;
34:
35: import com.meterware.httpunit.*;
36:
37: public abstract class TestMetricsBase extends TestBase {
38: public void testDirectQuery() throws Exception {
39: request.setParameter("scope-includes", "//");
40: request.setParameter("package-scope", "on");
41: request.setParameter("class-scope", "on");
42: request.setParameter("feature-scope", "on");
43: request.setParameter("filter-includes", "//");
44: request.setParameter("package-filter", "on");
45: request.setParameter("class-filter", "on");
46: request.setParameter("feature-filter", "on");
47: request.setParameter("submit", "Run Query");
48:
49: context.service();
50: WebResponse response = client.getResponse(request);
51: String text = response.getText();
52:
53: assertTrue("Missing text in " + text, text
54: .contains("5 package(s)"));
55: assertTrue("Missing text in " + text, text
56: .contains("5 class(es)"));
57: assertTrue("Missing text in " + text, text
58: .contains("5 feature(s)"));
59:
60: assertTrue("Missing text in " + text, text
61: .contains("4 outbound link(s)"));
62: assertTrue("Missing text in " + text, text
63: .contains("0 from package(s)"));
64: assertTrue("Missing text in " + text, text
65: .contains("0 from class(es)"));
66: assertTrue("Missing text in " + text, text
67: .contains("4 from feature(s)"));
68:
69: assertTrue("Missing text in " + text, text
70: .contains("4 inbound link(s)"));
71: assertTrue("Missing text in " + text, text
72: .contains("0 to package(s)"));
73: assertTrue("Missing text in " + text, text
74: .contains("0 to class(es)"));
75: assertTrue("Missing text in " + text, text
76: .contains("4 to feature(s)"));
77: }
78: }
|