File tree Expand file tree Collapse file tree 4 files changed +14
-50
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc
utbot-summary/src/main/kotlin/org/utbot/summary/comment
utbot-summary-tests/src/test/kotlin/examples Expand file tree Collapse file tree 4 files changed +14
-50
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ private const val MESSAGE_SEPARATOR = ":"
22
22
23
23
private val logger = KotlinLogging .logger {}
24
24
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
+ */
25
32
class UtJavaDocInfoGenerator {
26
- /* *
27
- * Generates UtBot specific sections to include them to rendered JavaDoc comment.
28
- */
29
33
fun addUtBotSpecificSectionsToJavaDoc (javadoc : String? , comment : PsiDocComment ): String {
30
34
val builder: StringBuilder = StringBuilder (javadoc)
31
35
val docTagProvider = UtCustomJavaDocTagProvider ()
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ import org.junit.jupiter.api.extension.BeforeEachCallback
5
5
import org.junit.jupiter.api.extension.ExtensionContext
6
6
import org.utbot.framework.UtSettings
7
7
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
+ */
8
14
class CustomJavaDocTagsEnabler (private val enable : Boolean = true ) : BeforeEachCallback, AfterEachCallback {
9
15
private var previousValue = false
10
16
Original file line number Diff line number Diff line change @@ -160,52 +160,6 @@ open class SummaryTestCaseGeneratorTest(
160
160
}
161
161
}
162
162
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
- " \n The 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
- " \n The 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
-
209
163
fun List<UtExecution>.checkMatchersWithMethodNames (
210
164
methodNames : List <String >,
211
165
) {
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ open class SimpleCommentBuilder(
119
119
return stmts
120
120
}
121
121
122
- fun findExceptionReason (currentMethod : SootMethod , thrownException : Throwable ): String {
122
+ protected fun findExceptionReason (currentMethod : SootMethod , thrownException : Throwable ): String {
123
123
val path = traceTag.path
124
124
if (path.isEmpty()) {
125
125
if (thrownException is ConcreteExecutionFailureException ) {
You can’t perform that action at this time.
0 commit comments