Skip to content

Commit 38ca8c6

Browse files
committed
Add comments, remove unused method
1 parent b1b02ab commit 38ca8c6

File tree

4 files changed

+14
-50
lines changed

4 files changed

+14
-50
lines changed

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc/UtJavaDocInfoGenerator.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ private const val MESSAGE_SEPARATOR = ":"
2222

2323
private val logger = KotlinLogging.logger {}
2424

25+
/**
26+
* Generates UtBot specific sections to include them to rendered JavaDoc comment.
27+
*
28+
* Methods responsible for value generation were taken from IJ platform class (they are private and couldn't be used outside).
29+
*
30+
* See [com.intellij.codeInsight.javadoc.JavaDocInfoGenerator].
31+
*/
2532
class UtJavaDocInfoGenerator {
26-
/**
27-
* Generates UtBot specific sections to include them to rendered JavaDoc comment.
28-
*/
2933
fun addUtBotSpecificSectionsToJavaDoc(javadoc: String?, comment: PsiDocComment): String {
3034
val builder: StringBuilder = StringBuilder(javadoc)
3135
val docTagProvider = UtCustomJavaDocTagProvider()

utbot-summary-tests/src/test/kotlin/examples/CustomJavaDocTagsEnabler.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import org.junit.jupiter.api.extension.BeforeEachCallback
55
import org.junit.jupiter.api.extension.ExtensionContext
66
import org.utbot.framework.UtSettings
77

8+
/**
9+
* Controls the value of useCustomJavaDocTags global variable.
10+
*
11+
* Should be used in summary tests containing custom JavaDoc tags.
12+
* To use it, add an annotation @ExtendWith(CustomJavaDocTagsEnabler::class) under test class.
13+
*/
814
class CustomJavaDocTagsEnabler(private val enable: Boolean = true) : BeforeEachCallback, AfterEachCallback {
915
private var previousValue = false
1016

utbot-summary-tests/src/test/kotlin/examples/SummaryTestCaseGeneratorTest.kt

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -160,52 +160,6 @@ open class SummaryTestCaseGeneratorTest(
160160
}
161161
}
162162

163-
fun List<UtExecution>.checkMatchersWithCustomTagsInSummary(
164-
comments: List<String>
165-
) {
166-
if (comments.isEmpty()) {
167-
return
168-
}
169-
170-
val notMatchedExecutions = this.filter { execution ->
171-
comments.none { comment ->
172-
execution.summary?.toString()?.contains(comment) == true
173-
}
174-
}
175-
176-
val notMatchedComments = comments.filter { comment ->
177-
this.none { execution ->
178-
execution.summary?.toString()?.contains(comment) == true
179-
}
180-
}
181-
182-
Assertions.assertTrue(notMatchedExecutions.isEmpty() && notMatchedComments.isEmpty()) {
183-
buildString {
184-
if (notMatchedExecutions.isNotEmpty()) {
185-
append(
186-
"\nThe following comments were produced by the UTBot, " +
187-
"but were not found in the list of comments passed in the check() method:\n\n${
188-
commentsFromExecutions(
189-
notMatchedExecutions
190-
)
191-
}"
192-
)
193-
}
194-
195-
if (notMatchedComments.isNotEmpty()) {
196-
append(
197-
"\nThe following comments were passed in the check() method, " +
198-
"but were not found in the list of comments produced by the UTBot:\n\n${
199-
comments(
200-
notMatchedComments
201-
)
202-
}"
203-
)
204-
}
205-
}
206-
}
207-
}
208-
209163
fun List<UtExecution>.checkMatchersWithMethodNames(
210164
methodNames: List<String>,
211165
) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ open class SimpleCommentBuilder(
119119
return stmts
120120
}
121121

122-
fun findExceptionReason(currentMethod: SootMethod, thrownException: Throwable): String {
122+
protected fun findExceptionReason(currentMethod: SootMethod, thrownException: Throwable): String {
123123
val path = traceTag.path
124124
if (path.isEmpty()) {
125125
if (thrownException is ConcreteExecutionFailureException) {

0 commit comments

Comments
 (0)