Refactoring: change parameters order in InTextDirectivesUtils
This commit is contained in:
@@ -34,7 +34,7 @@ public final class InTextDirectivesUtils {
|
||||
|
||||
@Nullable
|
||||
public static Integer getPrefixedInt(String fileText, String prefix) {
|
||||
String[] numberStrings = findArrayWithPrefix(prefix, fileText);
|
||||
String[] numberStrings = findArrayWithPrefix(fileText, prefix);
|
||||
if (numberStrings.length > 0) {
|
||||
return Integer.parseInt(numberStrings[0]);
|
||||
}
|
||||
@@ -43,15 +43,15 @@ public final class InTextDirectivesUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String[] findArrayWithPrefix(String prefix, String fileText) {
|
||||
return ArrayUtil.toStringArray(findListWithPrefix(prefix, fileText));
|
||||
public static String[] findArrayWithPrefix(String fileText, String prefix) {
|
||||
return ArrayUtil.toStringArray(findListWithPrefix(fileText, prefix));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> findListWithPrefix(String prefix, String fileText) {
|
||||
public static List<String> findListWithPrefix(String fileText, String prefix) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
for (String line : findLinesWithPrefixRemoved(prefix, fileText)) {
|
||||
for (String line : findLinesWithPrefixRemoved(fileText, prefix)) {
|
||||
String[] variants = line.split(",");
|
||||
|
||||
for (String variant : variants) {
|
||||
@@ -63,8 +63,8 @@ public final class InTextDirectivesUtils {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String findStringWithPrefix(String prefix, String fileText) {
|
||||
List<String> strings = findListWithPrefix(prefix, fileText);
|
||||
public static String findStringWithPrefix(String fileText, String prefix) {
|
||||
List<String> strings = findListWithPrefix(fileText, prefix);
|
||||
if (strings.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public final class InTextDirectivesUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<String> findLinesWithPrefixRemoved(String prefix, String fileText) {
|
||||
public static List<String> findLinesWithPrefixRemoved(String fileText, String prefix) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
|
||||
for (String line : fileNonEmptyLines(fileText)) {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public abstract class AbstractDefaultConstructorCodegenTest extends CodegenTestC
|
||||
}
|
||||
|
||||
private String loadInstructionValue(String fileContent, String instructionName) {
|
||||
List<String> testedClass = findListWithPrefix("// " + instructionName + ": ", fileContent);
|
||||
List<String> testedClass = findListWithPrefix(fileContent, "// " + instructionName + ": ");
|
||||
assertTrue("Cannot find " + instructionName + " instruction", !testedClass.isEmpty());
|
||||
assertTrue(instructionName + " instruction must have only one element", testedClass.size() == 1);
|
||||
return testedClass.get(0);
|
||||
|
||||
@@ -94,7 +94,7 @@ public abstract class AbstractWriteFlagsTest extends UsefulTestCase {
|
||||
|
||||
private static TestedObject parseExpectedTestedObject(String fileText) {
|
||||
TestedObject result = new TestedObject();
|
||||
List<String> testedObjects = findListWithPrefix("// TESTED_OBJECTS: ", fileText);
|
||||
List<String> testedObjects = findListWithPrefix(fileText, "// TESTED_OBJECTS: ");
|
||||
assertTrue("Cannot find TESTED_OBJECTS instruction", !testedObjects.isEmpty());
|
||||
result.containingClass = testedObjects.get(0);
|
||||
if (testedObjects.size() == 1) {
|
||||
@@ -108,8 +108,8 @@ public abstract class AbstractWriteFlagsTest extends UsefulTestCase {
|
||||
"TESTED_OBJECTS instruction must contains one (for class) or two (for function and property) values");
|
||||
}
|
||||
|
||||
result.kind = findStringWithPrefix("// TESTED_OBJECT_KIND: ", fileText);
|
||||
List<String> isFullName = findListWithPrefix("// IS_FULL_CONTAINING_CLASS_NAME: ", fileText);
|
||||
result.kind = findStringWithPrefix(fileText, "// TESTED_OBJECT_KIND: ");
|
||||
List<String> isFullName = findListWithPrefix(fileText, "// IS_FULL_CONTAINING_CLASS_NAME: ");
|
||||
if (isFullName.size() == 1) {
|
||||
result.isFullContainingClassName = Boolean.parseBoolean(isFullName.get(0));
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public abstract class AbstractWriteFlagsTest extends UsefulTestCase {
|
||||
private static int getExpectedFlags(String text) {
|
||||
int expectedAccess = 0;
|
||||
Class klass = Opcodes.class;
|
||||
List<String> flags = findListWithPrefix("// FLAGS: ", text);
|
||||
List<String> flags = findListWithPrefix(text, "// FLAGS: ");
|
||||
for (String flag : flags) {
|
||||
try {
|
||||
Field field = klass.getDeclaredField(flag);
|
||||
|
||||
Reference in New Issue
Block a user