Rename: Implement automatic renamer for test classes
#KT-8512 Fixed
This commit is contained in:
+26
-10
@@ -189,8 +189,8 @@ public class ConfigLibraryUtil {
|
||||
addLibrary(editor, module);
|
||||
}
|
||||
|
||||
public static void configureLibrariesByDirective(@NotNull Module module, String rootPath, String fileText) {
|
||||
for (String libraryInfo : InTextDirectivesUtils.findListWithPrefixes(fileText, "// CONFIGURE_LIBRARY: ")) {
|
||||
public static void configureLibraries(@NotNull Module module, String rootPath, List<String> libraryInfos) {
|
||||
for (String libraryInfo : libraryInfos) {
|
||||
int i = libraryInfo.indexOf('@');
|
||||
String libraryName = libraryInfo.substring(0, i);
|
||||
String[] jarPaths = libraryInfo.substring(i + 1).split(";");
|
||||
@@ -198,6 +198,29 @@ public class ConfigLibraryUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void unconfigureLibrariesByName(@NotNull Module module, List<String> libraryNames) {
|
||||
for (Iterator<String> iterator = libraryNames.iterator(); iterator.hasNext(); ) {
|
||||
String libraryName = iterator.next();
|
||||
if (removeLibrary(module, libraryName)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (!libraryNames.isEmpty()) throw new AssertionError("Couldn't find the following libraries: " + libraryNames);
|
||||
}
|
||||
|
||||
public static void unconfigureLibrariesByInfo(@NotNull Module module, List<String> libraryInfos) {
|
||||
List<String> libraryNames = new ArrayList<String>();
|
||||
for (String libraryInfo : libraryInfos) {
|
||||
libraryNames.add(libraryInfo.substring(0, libraryInfo.indexOf('@')));
|
||||
}
|
||||
unconfigureLibrariesByName(module, libraryNames);
|
||||
}
|
||||
|
||||
public static void configureLibrariesByDirective(@NotNull Module module, String rootPath, String fileText) {
|
||||
configureLibraries(module, rootPath, InTextDirectivesUtils.findListWithPrefixes(fileText, "// CONFIGURE_LIBRARY: "));
|
||||
}
|
||||
|
||||
public static void unconfigureLibrariesByDirective(@NotNull Module module, String fileText) {
|
||||
List<String> libraryNames = new ArrayList<String>();
|
||||
for (String libInfo : InTextDirectivesUtils.findListWithPrefixes(fileText, "// CONFIGURE_LIBRARY: ")) {
|
||||
@@ -207,13 +230,6 @@ public class ConfigLibraryUtil {
|
||||
libraryNames.add(libraryName);
|
||||
}
|
||||
|
||||
for (Iterator<String> iterator = libraryNames.iterator(); iterator.hasNext(); ) {
|
||||
String libraryName = iterator.next();
|
||||
if (removeLibrary(module, libraryName)) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (!libraryNames.isEmpty()) throw new AssertionError("Couldn't find the following libraries: " + libraryNames);
|
||||
unconfigureLibrariesByName(module, libraryNames);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user