KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > net > sourceforge > pmd > RuleContextTest


1 /**
2  * <copyright>
3  * Copyright 1997-2002 InfoEther, LLC
4  * under sponsorship of the Defense Advanced Research Projects Agency
5  (DARPA).
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the Cougaar Open Source License as published
9  by
10  * DARPA on the Cougaar Open Source Website (www.cougaar.org).
11  *
12  * THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS
13  * PROVIDED 'AS IS' WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR
14  * IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT
16  * ANY WARRANTIES AS TO NON-INFRINGEMENT. IN NO EVENT SHALL COPYRIGHT
17  * HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL
18  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS,
19  * TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20  * PERFORMANCE OF THE COUGAAR SOFTWARE.
21  * </copyright>
22  */

23 package test.net.sourceforge.pmd;
24
25 import junit.framework.TestCase;
26 import net.sourceforge.pmd.Report;
27 import net.sourceforge.pmd.RuleContext;
28
29 public class RuleContextTest extends TestCase {
30
31     public void testReport() {
32         RuleContext ctx = new RuleContext();
33         assertEquals(0, ctx.getReport().size());
34         Report r = new Report();
35         ctx.setReport(r);
36         Report r2 = ctx.getReport();
37         assertEquals("report object mismatch", r, r2);
38     }
39
40     public void testFilename() {
41         RuleContext ctx = new RuleContext();
42         assertNull("filename should be null", ctx.getSourceCodeFilename());
43         ctx.setSourceCodeFilename("foo");
44         assertEquals("filename mismatch", "foo", ctx.getSourceCodeFilename());
45     }
46 }
47
Popular Tags