show conflict if move as enum would change the semantics (IDEA-163248)

This commit is contained in:
Anna.Kozlova
2016-11-15 18:11:31 +01:00
parent 6298068d8b
commit 38116b22c1
7 changed files with 83 additions and 26 deletions
@@ -1,2 +1,5 @@
public class B {
{
Object o = A.ONE;
}
}
@@ -1,3 +1,6 @@
public class B {
public static final String ONE = "";
public static final String ONE = "";
{
Object o = ONE;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -119,7 +119,13 @@ public class MoveMembersTest extends MultiFileTestCase {
}
public void testEnumConstantFromCaseStatement() throws Exception {
doTest("B", "A", 0);
try {
doTest("B", "A", 0);
fail("Conflict expected");
}
catch (BaseRefactoringProcessor.ConflictsInTestsException e) {
assertEquals("Enum type won't be applicable in the current context", e.getMessage());
}
}
public void testStringConstantFromCaseStatement() throws Exception {