01: package net.sf.clirr.core.internal.checks;
02:
03: import net.sf.clirr.core.internal.ClassChangeCheck;
04: import net.sf.clirr.core.Severity;
05: import net.sf.clirr.core.ClassSelector;
06: import net.sf.clirr.core.ClassFilter;
07: import net.sf.clirr.core.internal.checks.ClassModifierCheck;
08: import net.sf.clirr.core.internal.checks.AbstractCheckTestCase;
09:
10: /**
11: * Tests for the ClassModifierCheck class.
12: */
13: public class ClassModifierCheckTest extends AbstractCheckTestCase {
14: public void testAll() throws Exception {
15: ExpectedDiff[] expected = new ExpectedDiff[] {
16: new ExpectedDiff("Added final modifier to class",
17: Severity.ERROR,
18: "testlib.modifiers.NonFinalBecomesFinal", null,
19: null),
20: new ExpectedDiff(
21: "Added final modifier to class, but class was effectively final anyway",
22: Severity.INFO,
23: "testlib.modifiers.EffectivelyFinal", null,
24: null), };
25: verify(expected);
26: }
27:
28: protected ClassChangeCheck createCheck(TestDiffListener tdl) {
29: return new ClassModifierCheck(tdl);
30: }
31:
32: protected ClassFilter createClassSelector() {
33: // only apply the check to classes in the testlib.modifiers package.
34: ClassSelector classSelector = new ClassSelector(
35: ClassSelector.MODE_IF);
36: classSelector.addPackage("testlib.modifiers");
37: return classSelector;
38: }
39: }
|