From aae0b85684652c8b763213ce7b68690cde4f48e5 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 3 Oct 2016 16:47:00 +0300 Subject: [PATCH] Refactoring: hide state of occurrence class (cherry picked from commit 4f438bc) --- .../kotlin/codegen/AbstractBytecodeTextTest.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/tests-common/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.java b/compiler/tests-common/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.java index 944c154d2c2..c5ed88a909e 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.java +++ b/compiler/tests-common/org/jetbrains/kotlin/codegen/AbstractBytecodeTextTest.java @@ -69,9 +69,8 @@ public abstract class AbstractBytecodeTextTest extends CodegenTestCase { StringBuilder actual = new StringBuilder(); for (OccurrenceInfo info : expectedOccurrences) { - expected.append(info.numberOfOccurrences).append(" ").append(info.needle).append("\n"); - int actualCount = StringUtil.findMatches(text, Pattern.compile("(" + info.needle + ")")).size(); - actual.append(actualCount).append(" ").append(info.needle).append("\n"); + expected.append(info).append("\n"); + actual.append(info.getActualOccurrence(text)).append("\n"); } try { @@ -170,5 +169,16 @@ public abstract class AbstractBytecodeTextTest extends CodegenTestCase { this.numberOfOccurrences = numberOfOccurrences; 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; + } } }