Refactoring: hide state of occurrence class
(cherry picked from commit 4f438bc)
This commit is contained in:
committed by
Nikolay Krasko
parent
3d9d6e666d
commit
aae0b85684
@@ -69,9 +69,8 @@ public abstract class AbstractBytecodeTextTest extends CodegenTestCase {
|
|||||||
StringBuilder actual = new StringBuilder();
|
StringBuilder actual = new StringBuilder();
|
||||||
|
|
||||||
for (OccurrenceInfo info : expectedOccurrences) {
|
for (OccurrenceInfo info : expectedOccurrences) {
|
||||||
expected.append(info.numberOfOccurrences).append(" ").append(info.needle).append("\n");
|
expected.append(info).append("\n");
|
||||||
int actualCount = StringUtil.findMatches(text, Pattern.compile("(" + info.needle + ")")).size();
|
actual.append(info.getActualOccurrence(text)).append("\n");
|
||||||
actual.append(actualCount).append(" ").append(info.needle).append("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -170,5 +169,16 @@ public abstract class AbstractBytecodeTextTest extends CodegenTestCase {
|
|||||||
this.numberOfOccurrences = numberOfOccurrences;
|
this.numberOfOccurrences = numberOfOccurrences;
|
||||||
this.needle = needle;
|
this.needle = needle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getActualOccurrence(String text) {
|
||||||
|
int actualCount = StringUtil.findMatches(text, Pattern.compile("(" + needle + ")")).size();
|
||||||
|
return actualCount + " " + needle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return numberOfOccurrences + " " + needle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user