Minor refactoring in InTextDirectivesUtils
This commit is contained in:
@@ -71,7 +71,7 @@ public class JetConfidenceTest extends LightCompletionTestCase {
|
||||
protected static String getTypeTextFromFile() {
|
||||
String text = getEditor().getDocument().getText();
|
||||
|
||||
String[] directives = InTextDirectivesUtils.findListWithPrefix(TYPE_DIRECTIVE_PREFIX, text);
|
||||
String[] directives = InTextDirectivesUtils.findArrayWithPrefix(TYPE_DIRECTIVE_PREFIX, text);
|
||||
assertEquals("One directive with \"" + TYPE_DIRECTIVE_PREFIX +"\" expected", 1, directives.length);
|
||||
|
||||
return StringUtil.unquoteString(directives[0]);
|
||||
|
||||
@@ -33,8 +33,8 @@ public class FormattingSettingsConfigurator {
|
||||
private final String[] settingsToFalse;
|
||||
|
||||
public FormattingSettingsConfigurator(String fileText) {
|
||||
settingsToTrue = InTextDirectivesUtils.findListWithPrefix("// SET_TRUE:", fileText);
|
||||
settingsToFalse = InTextDirectivesUtils.findListWithPrefix("// SET_FALSE:", fileText);
|
||||
settingsToTrue = InTextDirectivesUtils.findArrayWithPrefix("// SET_TRUE:", fileText);
|
||||
settingsToFalse = InTextDirectivesUtils.findArrayWithPrefix("// SET_FALSE:", fileText);
|
||||
}
|
||||
|
||||
public void configureSettings(CodeStyleSettings settings) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class ImplementationTestUtils {
|
||||
|
||||
public static void assertGotoImplementations(Editor editor, GotoTargetHandler.GotoData gotoData) {
|
||||
// Get expected references from the tested document
|
||||
List<String> expectedReferences = Arrays.asList(InTextDirectivesUtils.findListWithPrefix("// REF:", editor.getDocument().getText()));
|
||||
List<String> expectedReferences = InTextDirectivesUtils.findListWithPrefix("// REF:", editor.getDocument().getText());
|
||||
Collections.sort(expectedReferences);
|
||||
|
||||
if (gotoData != null) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class InTextDirectivesUtils {
|
||||
|
||||
@Nullable
|
||||
public static Integer getPrefixedInt(String fileText, String prefix) {
|
||||
final String[] numberStrings = findListWithPrefix(prefix, fileText);
|
||||
final String[] numberStrings = findArrayWithPrefix(prefix, fileText);
|
||||
if (numberStrings.length > 0) {
|
||||
return Integer.parseInt(numberStrings[0]);
|
||||
}
|
||||
@@ -46,7 +46,12 @@ public final class InTextDirectivesUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] findListWithPrefix(String prefix, String fileText) {
|
||||
public static String[] findArrayWithPrefix(String prefix, String fileText) {
|
||||
return ArrayUtil.toStringArray(findListWithPrefix(prefix, fileText));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> findListWithPrefix(String prefix, String fileText) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
for (String line : findLinesWithPrefixRemoved(prefix, fileText)) {
|
||||
@@ -57,7 +62,7 @@ public final class InTextDirectivesUtils {
|
||||
}
|
||||
}
|
||||
|
||||
return ArrayUtil.toStringArray(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user