Skip to content

Commit 7a22212

Browse files
committed
* More tests
1 parent 838177b commit 7a22212

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

utbot-framework-test/src/test/kotlin/org/utbot/examples/strings/StringExamplesTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ internal class StringExamplesTest : UtValueTestCaseChecker(
237237
)
238238
}
239239

240+
@Test
241+
fun testIsStringBuilderEmpty() {
242+
check(
243+
StringExamples::isStringBuilderEmpty,
244+
eq(2),
245+
{ stringBuilder, result -> result == stringBuilder.isEmpty() }
246+
)
247+
}
248+
240249
@Test
241250
@Disabled("Flaky on GitHub: https://github.com/UnitTestBot/UTBotJava/issues/1004")
242251
fun testIsValidUuid() {

utbot-framework/src/main/java/org/utbot/engine/overrides/collections/UtArrayList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public String toString() {
179179
if (size > 1) {
180180
for (int i = 1; i < size; i++) {
181181
builder.append(", ");
182-
builder.append(get(i).toString());
182+
builder.append(get(i));
183183
}
184184
}
185185
builder.append("]");

utbot-sample/src/main/java/org/utbot/examples/strings/StringExamples.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.utbot.examples.strings;
22

3+
import org.jetbrains.annotations.NotNull;
4+
35
import java.util.Arrays;
46

57
import static java.lang.Boolean.valueOf;
@@ -175,6 +177,16 @@ public String nullableStringBuffer(StringBuffer buffer, int i) {
175177
return buffer.toString();
176178
}
177179

180+
@SuppressWarnings("RedundantIfStatement")
181+
public boolean isStringBuilderEmpty(@NotNull StringBuilder stringBuilder) {
182+
String content = stringBuilder.toString();
183+
if (content.length() == 0) {
184+
return true;
185+
}
186+
187+
return false;
188+
}
189+
178190
public boolean isValidUuid(String uuid) {
179191
return isNotBlank(uuid) && uuid
180192
.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}");

0 commit comments

Comments
 (0)