diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilder.kt index 3c1328e1ad..3fff8b1fba 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilder.kt @@ -33,9 +33,11 @@ class SimpleClusterCommentBuilder( skippedIterations() buildSentenceBlock(traceTag.rootStatementTag, root, currentMethod) var sentence = toSentence(root) + if (sentence.isEmpty()) { - return genWarnNotification() + return EMPTY_STRING } + sentence = splitLongSentence(sentence) sentence = lastCommaToDot(sentence) @@ -50,7 +52,7 @@ class SimpleClusterCommentBuilder( val sentence = toDocStmts(root) if (sentence.isEmpty()) { - return listOf(DocRegularStmt(genWarnNotification())) //TODO SAT-1310 + return emptyList() } // sentence = splitLongSentence(sentence) //TODO SAT-1309 // sentence = lastCommaToDot(sentence) //TODO SAT-1309 diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt index 2c6533fc6a..3f8878f8e9 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt @@ -29,6 +29,7 @@ import soot.jimple.internal.JInvokeStmt import soot.jimple.internal.JVirtualInvokeExpr private const val JVM_CRASH_REASON = "JVM crash" +const val EMPTY_STRING = "" open class SimpleCommentBuilder( traceTag: TraceTagWithoutExecution, @@ -46,7 +47,11 @@ open class SimpleCommentBuilder( skippedIterations() buildSentenceBlock(traceTag.rootStatementTag, root, currentMethod) var sentence = toSentence(root) - if (sentence.isEmpty()) return genWarnNotification() + + if (sentence.isEmpty()) { + return EMPTY_STRING + } + sentence = splitLongSentence(sentence) sentence = lastCommaToDot(sentence) @@ -72,7 +77,7 @@ open class SimpleCommentBuilder( val docStmts = toDocStmts(sentenceBlock) if (docStmts.isEmpty()) { - return listOf(DocRegularStmt(genWarnNotification())) //TODO SAT-1310 + return emptyList() } // sentence = splitLongSentence(sentence) //TODO SAT-1309 // sentence = lastCommaToDot(sentence) //TODO SAT-1309 @@ -88,8 +93,6 @@ open class SimpleCommentBuilder( return rootSentenceBlock } - protected fun genWarnNotification(): String = " " //why is it empty? - /** * Transforms rootSentenceBlock into String */ diff --git a/utbot-summary/src/test/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilderTest.kt b/utbot-summary/src/test/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilderTest.kt index fe3c808717..42291edb58 100644 --- a/utbot-summary/src/test/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilderTest.kt +++ b/utbot-summary/src/test/kotlin/org/utbot/summary/comment/SimpleClusterCommentBuilderTest.kt @@ -15,6 +15,8 @@ import soot.SootMethod import soot.jimple.Stmt import soot.jimple.internal.JReturnStmt +private const val EMPTY_STRING = "" + @TestInstance(TestInstance.Lifecycle.PER_CLASS) class SimpleClusterCommentBuilderTest { private lateinit var traceTag: TraceTag @@ -48,15 +50,13 @@ class SimpleClusterCommentBuilderTest { fun `builds empty comment if execution result is null`() { val commentBuilder = SimpleClusterCommentBuilder(traceTag, sootToAst) val comment = commentBuilder.buildString(sootMethod) - assertEquals(" ", comment) + assertEquals(EMPTY_STRING, comment) } @Test - fun `builds empty doc statement if execution result is null`() { + fun `does not build any statements for javadoc if execution result is null`() { val commentBuilder = SimpleClusterCommentBuilder(traceTag, sootToAst) val statements = commentBuilder.buildDocStmts(sootMethod) - assertEquals(statements.size, 1) - assertEquals(statements[0].toString(), " ") + assertEquals(statements.size, 0) } - } \ No newline at end of file