コード例 #1
0
 public void testCheckAmbiguityInRoleMethodSpec3() throws Exception {
   // check ambiguous role method specifier in callout binding of T3.R2
   RefactoringStatus expected =
       RefactoringUtil.addAmbiguityFatalError(null, new ExtractMethodAmbuguityMsgCreator());
   RefactoringStatus actual =
       RefactoringUtil.checkForAmbiguousRoleMethodSpecs(
           _t3r2, "m", new ExtractMethodAmbuguityMsgCreator());
   assertEquals(expected.getSeverity(), actual.getSeverity());
   assertNotNull(
       expected.getEntryMatchingCode(
           Corext.getPluginId(), OTRefactoringStatusCodes.AMBIGUOUS_METHOD_SPECIFIER));
   assertNotNull(
       actual.getEntryMatchingCode(
           Corext.getPluginId(), OTRefactoringStatusCodes.AMBIGUOUS_METHOD_SPECIFIER));
 }
コード例 #2
0
 public void testCheckAmbiguityInBaseMethodSpec2() throws Exception {
   // check ambiguous base method specifier in callout binding of T3.R2
   RefactoringStatus expected =
       RefactoringUtil.addAmbiguityFatalError(null, new ExtractMethodAmbuguityMsgCreator());
   ArrayList<IRoleType> boundRole = new ArrayList<IRoleType>();
   boundRole.add(_t3r2);
   RefactoringStatus actual =
       RefactoringUtil.checkForAmbiguousBaseMethodSpecs(
           boundRole, "f", "", new ExtractMethodAmbuguityMsgCreator());
   assertEquals(expected.getSeverity(), actual.getSeverity());
   assertNotNull(
       expected.getEntryMatchingCode(
           Corext.getPluginId(), OTRefactoringStatusCodes.AMBIGUOUS_METHOD_SPECIFIER));
   assertNotNull(
       actual.getEntryMatchingCode(
           Corext.getPluginId(), OTRefactoringStatusCodes.AMBIGUOUS_METHOD_SPECIFIER));
 }
コード例 #3
0
 /* test overloading of private base method */
 public void testCheckOverloading9() throws Exception {
   // focus type -> C
   ICompilationUnit cu = _c.getCompilationUnit();
   int[] selection = getSelection(cu.getSource());
   _refactoring = new ExtractMethodRefactoring(cu, selection[0], selection[1]);
   _refactoring.setMethodName("n");
   _refactoring.setVisibility(Modifier.PRIVATE);
   _refactoring.checkInitialConditions(new NullProgressMonitor());
   IMethod[] inheritedMethods = RefactoringUtil.getInheritedMethods(_c, true, true, false, null);
   RefactoringStatus expected =
       RefactoringUtil.addOverloadingWarning(new ExtractMethodOverloadingMsgCreator());
   RefactoringStatus actual =
       RefactoringUtil.checkOverloading(
           inheritedMethods,
           _refactoring.getMethodName(),
           fetchNewParameterTypes(),
           new ExtractMethodOverloadingMsgCreator());
   assertEquals(expected.getSeverity(), actual.getSeverity());
   assertNotNull(
       expected.getEntryMatchingCode(Corext.getPluginId(), OTRefactoringStatusCodes.OVERLOADING));
   assertNotNull(
       actual.getEntryMatchingCode(Corext.getPluginId(), OTRefactoringStatusCodes.OVERLOADING));
 }