[Clirr-devel] CVS: clirr/src/test/net/sf/clirr/checks ClassScopeCheckTest.java,NONE,1.1
Status: Alpha
Brought to you by:
lkuehne
From: Simon K. <s_k...@us...> - 2004-06-18 07:59:30
|
Update of /cvsroot/clirr/clirr/src/test/net/sf/clirr/checks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8197/test/net/sf/clirr/checks Added Files: ClassScopeCheckTest.java Log Message: Added check which determines whether a class has changed its scope (public/protected/package/private) between releases. Also added unit tests for this change. --- NEW FILE --- package net.sf.clirr.checks; import net.sf.clirr.framework.ClassChangeCheck; import net.sf.clirr.event.ApiDifference; import net.sf.clirr.event.Severity; import net.sf.clirr.event.ScopeSelector; import net.sf.clirr.framework.ClassSelector; /** * Tests for the ClassScopeCheck test. * * @author Simon Kitching */ public class ClassScopeCheckTest extends AbstractCheckTestCase { public void testAccessChangesAreReported() { ApiDifference[] expected = new ApiDifference[] { new ApiDifference("Decreased visibility of class from public to protected", Severity.ERROR, "testlib.scope.ClassScopeChange$A2", null, null), new ApiDifference("Decreased visibility of class from public to package", Severity.ERROR, "testlib.scope.ClassScopeChange$A3", null, null), new ApiDifference("Decreased visibility of class from public to private", Severity.ERROR, "testlib.scope.ClassScopeChange$A4", null, null), new ApiDifference("Increased visibility of class from protected to public", Severity.INFO, "testlib.scope.ClassScopeChange$B2", null, null), new ApiDifference("Decreased visibility of class from protected to package", Severity.ERROR, "testlib.scope.ClassScopeChange$B3", null, null), new ApiDifference("Decreased visibility of class from protected to private", Severity.ERROR, "testlib.scope.ClassScopeChange$B4", null, null), new ApiDifference("Increased visibility of class from package to public", Severity.INFO, "testlib.scope.ClassScopeChange$C2", null, null), new ApiDifference("Increased visibility of class from package to protected", Severity.INFO, "testlib.scope.ClassScopeChange$C3", null, null), new ApiDifference("Decreased visibility of class from package to private", Severity.ERROR, "testlib.scope.ClassScopeChange$C4", null, null), new ApiDifference("Increased visibility of class from private to public", Severity.INFO, "testlib.scope.ClassScopeChange$D2", null, null), new ApiDifference("Increased visibility of class from private to protected", Severity.INFO, "testlib.scope.ClassScopeChange$D3", null, null), new ApiDifference("Increased visibility of class from private to package", Severity.INFO, "testlib.scope.ClassScopeChange$D4", null, null), }; verify(expected); } protected ClassChangeCheck createCheck(TestDiffListener tdl) { ScopeSelector scopeSelector = new ScopeSelector(ScopeSelector.SCOPE_PRIVATE); return new ClassScopeCheck(tdl, scopeSelector); } protected ClassSelector createClassSelector() { // only check the testlib/scope/ClassScopeChange class. ClassSelector classSelector = new ClassSelector(ClassSelector.MODE_IF); classSelector.addClass("testlib.scope.ClassScopeChange"); return classSelector; } } |