コード例 #1
0
 public void testConflictingMethodName() throws Exception {
   try {
     doTestInplaceRename("bar");
   } catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
     assertEquals(
         "Method bar() is already defined in the class <b><code>Foo</code></b>.", e.getMessage());
     checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
     return;
   }
   fail("Conflict was not detected");
 }
コード例 #2
0
 public void testRenameMethodCollisionWithOtherSignature() throws Exception {
   try {
     doTest("foo2");
   } catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
     Assert.assertEquals(
         "Method call would be linked to \"method <b><code>RenameTest.foo2(Long)</code></b>\" after rename",
         e.getMessage());
     return;
   }
   fail("Conflicts were not found");
 }
コード例 #3
0
 public void testRenameLocalVariableHidesFieldInAnonymous() throws Exception {
   try {
     doTest("y");
   } catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
     Assert.assertEquals(
         "There is already a field <b><code>y</code></b>. It will conflict with the renamed variable",
         e.getMessage());
     return;
   }
   fail("Conflicts were not found");
 }
コード例 #4
0
 public void testImplicitCtrCall2() throws Exception {
   try {
     doTest("Super");
     fail();
   } catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
     String message = e.getMessage();
     assertTrue(
         message,
         message.startsWith(
             "constructor <b><code>Super.Super()</code></b> has 1 usage that is not safe to delete"));
   }
 }
コード例 #5
0
 public void testLocalVariableSideEffect() throws Exception {
   myDoCompare = false;
   try {
     doTest("Super");
     fail("Side effect was ignored");
   } catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
     String message = e.getMessage();
     assertTrue(
         message,
         message.startsWith(
             "local variable <b><code>varName</code></b> has 1 usage that is not safe to delete.\n"
                 + "Of those 0 usages are in strings, comments, or non-code files."));
   }
 }