Skip to content

Commit 4951b6f

Browse files
committed
review fixes
1 parent 21a7035 commit 4951b6f

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/tree/CgElement.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ class CgDocPreTagStatement(content: List<CgDocStatement>) : CgDocTagStatement(co
337337
override fun hashCode(): Int = content.hashCode()
338338
}
339339

340+
/**
341+
* Represents a type for statements containing custom JavaDoc tags.
342+
*/
340343
data class CgCustomTagStatement(val statements: List<CgDocStatement>) : CgDocTagStatement(statements)
341344

342345
class CgDocCodeStmt(val stmt: String) : CgDocStatement() {

utbot-summary/src/main/kotlin/org/utbot/summary/Summarization.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ class Summarization(val sourceFile: File?, val invokeDescriptions: List<InvokeDe
155155
}
156156

157157
for (traceTags in clusterTraceTags.traceTags) {
158-
if (GENERATE_COMMENTS && UtSettings.useCustomJavaDocTags) {
159-
traceTags.execution.summary =
160-
CustomJavaDocCommentBuilder(traceTags, sootToAST).buildDocStatements(methodUnderTest)
161-
} else if (GENERATE_COMMENTS) {
162-
traceTags.execution.summary =
163-
SimpleCommentBuilder(traceTags, sootToAST).buildDocStmts(methodUnderTest)
158+
if (GENERATE_COMMENTS) {
159+
if (UtSettings.useCustomJavaDocTags) {
160+
traceTags.execution.summary =
161+
CustomJavaDocCommentBuilder(traceTags, sootToAST).buildDocStatements(methodUnderTest)
162+
} else {
163+
traceTags.execution.summary =
164+
SimpleCommentBuilder(traceTags, sootToAST).buildDocStmts(methodUnderTest)
165+
}
164166
}
165167

166168
if (GENERATE_DISPLAY_NAMES || GENERATE_NAMES) {

utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import org.utbot.summary.ast.JimpleToASTMap
77
import org.utbot.summary.tag.TraceTagWithoutExecution
88
import soot.SootMethod
99

10+
/**
11+
* Builds JavaDoc comments for generated tests using plugin's custom JavaDoc tags.
12+
*/
1013
class CustomJavaDocCommentBuilder(
1114
traceTag: TraceTagWithoutExecution,
1215
sootToAST: MutableMap<SootMethod, JimpleToASTMap>
@@ -72,7 +75,7 @@ class CustomJavaDocCommentBuilder(
7275
StmtType.Condition -> customJavaDocComment.executesCondition += "{@code ${statement.description}}"
7376
StmtType.Return -> customJavaDocComment.returnsFrom = "{@code ${statement.description}}"
7477
else -> {
75-
//TODO: do we need to handle others?
78+
//TODO: see [issue-773](https://github.com/UnitTestBot/UTBotJava/issues/773)
7679
}
7780
}
7881
}

0 commit comments

Comments
 (0)