File tree Expand file tree Collapse file tree 5 files changed +16
-52
lines changed
utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/javadoc
utbot-summary-tests/src/test/kotlin/examples
utbot-summary/src/main/kotlin/org/utbot/summary/comment Expand file tree Collapse file tree 5 files changed +16
-52
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ private const val MESSAGE_SEPARATOR = ":"
2222
2323private 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+ */
2532class 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 ()
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ import org.junit.jupiter.api.extension.BeforeEachCallback
55import org.junit.jupiter.api.extension.ExtensionContext
66import 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+ */
814class CustomJavaDocTagsEnabler (private val enable : Boolean = true ) : BeforeEachCallback, AfterEachCallback {
915 private var previousValue = false
1016
Original file line number Diff line number Diff 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- " \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-
209163 fun List<UtExecution>.checkMatchersWithMethodNames (
210164 methodNames : List <String >,
211165 ) {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class SimpleClusterCommentBuilder(
6363 * Builds sentence blocks as parent one,
6464 * but ignores few types of statementTag that are considered in SimpleCommentBuilder
6565 */
66- override fun buildSentenceBlock (
66+ private fun buildSentenceBlock (
6767 statementTag : StatementTag ? ,
6868 sentenceBlock : SimpleSentenceBlock ,
6969 currentMethod : SootMethod
Original file line number Diff line number Diff 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 ) {
@@ -166,7 +166,7 @@ open class SimpleCommentBuilder(
166166 /* *
167167 * Sentence blocks are built based on unique and partly unique statement tags.
168168 */
169- open fun buildSentenceBlock (
169+ private fun buildSentenceBlock (
170170 statementTag : StatementTag ? ,
171171 sentenceBlock : SimpleSentenceBlock ,
172172 currentMethod : SootMethod
You can’t perform that action at this time.
0 commit comments