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"); }
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"); }
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"); }
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")); } }
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.")); } }