From: <lk...@us...> - 2007-07-09 19:42:01
|
Update of /cvsroot/clirr/clirr/core/src/test/net/sf/clirr/core/internal/checks In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9052/src/test/net/sf/clirr/core/internal/checks Modified Files: ClassScopeCheckTest.java Log Message: Fixed unit tests for scope change of inner classes. Index: ClassScopeCheckTest.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/test/net/sf/clirr/core/internal/checks/ClassScopeCheckTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ClassScopeCheckTest.java 9 Jan 2006 21:38:38 -0000 1.5 +++ ClassScopeCheckTest.java 9 Jul 2007 19:41:52 -0000 1.6 @@ -16,23 +16,54 @@ { public void testAccessChangesAreReported() throws Exception { + // note that + // - protected inner classes are technically public but have a protected constructor. + // - private inner classes are technically package visible + // Hence on the class level there are fewer changes than one might expect + // Don't believe this? Try using the JDK's javap tool on the inner classes! ExpectedDiff[] expected = new ExpectedDiff[] { - new ExpectedDiff("Decreased visibility of class from public to protected", Severity.ERROR, "testlib.scope.ClassScopeChange$A2", null, null), - new ExpectedDiff("Decreased visibility of class from public to package", Severity.ERROR, "testlib.scope.ClassScopeChange$A3", null, null), - new ExpectedDiff("Decreased visibility of class from public to private", Severity.ERROR, "testlib.scope.ClassScopeChange$A4", null, null), - - new ExpectedDiff("Increased visibility of class from protected to public", Severity.INFO, "testlib.scope.ClassScopeChange$B2", null, null), - new ExpectedDiff("Decreased visibility of class from protected to package", Severity.ERROR, "testlib.scope.ClassScopeChange$B3", null, null), - new ExpectedDiff("Decreased visibility of class from protected to private", Severity.ERROR, "testlib.scope.ClassScopeChange$B4", null, null), - - new ExpectedDiff("Increased visibility of class from package to public", Severity.INFO, "testlib.scope.ClassScopeChange$C2", null, null), - new ExpectedDiff("Increased visibility of class from package to protected", Severity.INFO, "testlib.scope.ClassScopeChange$C3", null, null), - // package->private is not an error, just an info, because we never report error for package or private diffs - new ExpectedDiff("Decreased visibility of class from package to private", Severity.INFO, "testlib.scope.ClassScopeChange$C4", null, null), - - new ExpectedDiff("Increased visibility of class from private to public", Severity.INFO, "testlib.scope.ClassScopeChange$D2", null, null), - new ExpectedDiff("Increased visibility of class from private to protected", Severity.INFO, "testlib.scope.ClassScopeChange$D3", null, null), - new ExpectedDiff("Increased visibility of class from private to package", Severity.INFO, "testlib.scope.ClassScopeChange$D4", null, null), + + // A1 is unchanged + + // A2 is still technically a public class in v2 + + new ExpectedDiff("Decreased visibility of class from public to package", Severity.ERROR, + "testlib.scope.ClassScopeChange$A3", null, null), + + // A4 is technically package visible in V2 + new ExpectedDiff("Decreased visibility of class from public to package", Severity.ERROR, + "testlib.scope.ClassScopeChange$A4", null, null), + + // B1 is unchanged + + // B2 has technically been a public class in v1 + + // B3 is technically public in v1 + new ExpectedDiff("Decreased visibility of class from public to package", Severity.ERROR, + "testlib.scope.ClassScopeChange$B3", null, null), + + // B4 is technically public in v1 and package visible in v2 + new ExpectedDiff("Decreased visibility of class from public to package", Severity.ERROR, + "testlib.scope.ClassScopeChange$B4", null, null), + + new ExpectedDiff("Increased visibility of class from package to public", Severity.INFO, + "testlib.scope.ClassScopeChange$C2", null, null), + + // B4 is technically package visible in v1 and public in v2 + new ExpectedDiff("Increased visibility of class from package to public", Severity.INFO, + "testlib.scope.ClassScopeChange$C3", null, null), + + // C4 is technically package visible in v2 + + // D1 is technically package visible in v1 + + new ExpectedDiff("Increased visibility of class from package to public", Severity.INFO, + "testlib.scope.ClassScopeChange$D2", null, null), + + new ExpectedDiff("Increased visibility of class from package to public", Severity.INFO, + "testlib.scope.ClassScopeChange$D3", null, null), + + // D4 is technically package visible in v1 }; verify(expected); } |