@@ -103,10 +103,11 @@ fun testFrameworkByName(testFramework: String): TestFramework =
103
103
*/
104
104
sealed class StaticsMocking (
105
105
var isConfigured : Boolean = false ,
106
+ override val id : String ,
106
107
override val displayName : String ,
107
108
override val description : String = " Use static methods mocking"
108
109
) : CodeGenerationSettingItem {
109
- override fun toString (): String = displayName
110
+ override fun toString (): String = id
110
111
111
112
// Get is mandatory because of the initialization order of the inheritors.
112
113
// Otherwise, in some cases we could get an incorrect value
@@ -119,11 +120,12 @@ sealed class StaticsMocking(
119
120
}
120
121
121
122
object NoStaticMocking : StaticsMocking(
123
+ id = " No static mocking" ,
122
124
displayName = " No static mocking" ,
123
125
description = " Do not use additional settings to mock static fields"
124
126
)
125
127
126
- object MockitoStaticMocking : StaticsMocking(displayName = " Mockito static mocking" ) {
128
+ object MockitoStaticMocking : StaticsMocking(id = " Mockito static mocking " , displayName = " Mockito static mocking" ) {
127
129
128
130
val mockedStaticClassId = BuiltinClassId (
129
131
name = " org.mockito.MockedStatic" ,
@@ -170,6 +172,7 @@ object MockitoStaticMocking : StaticsMocking(displayName = "Mockito static mocki
170
172
}
171
173
172
174
sealed class TestFramework (
175
+ override val id : String ,
173
176
override val displayName : String ,
174
177
override val description : String = " Use $displayName as test framework" ,
175
178
) : CodeGenerationSettingItem {
@@ -235,7 +238,7 @@ sealed class TestFramework(
235
238
additionalArguments : List <String >
236
239
): List <String >
237
240
238
- override fun toString () = displayName
241
+ override fun toString () = id
239
242
240
243
// Get is mandatory because of the initialization order of the inheritors.
241
244
// Otherwise, in some cases we could get an incorrect value, i.e. allItems = [null, JUnit5, TestNg]
@@ -246,7 +249,7 @@ sealed class TestFramework(
246
249
}
247
250
}
248
251
249
- object TestNg : TestFramework(displayName = " TestNG" ) {
252
+ object TestNg : TestFramework(id = " TestNG " , displayName = " TestNG" ) {
250
253
override val mainPackage: String = TEST_NG_PACKAGE
251
254
override val testAnnotation: String = " @$mainPackage .Test"
252
255
override val testAnnotationFqn: String = " $mainPackage .Test"
@@ -375,7 +378,7 @@ object TestNg : TestFramework(displayName = "TestNG") {
375
378
""" .trimIndent()
376
379
}
377
380
378
- object Junit4 : TestFramework(" JUnit4" ) {
381
+ object Junit4 : TestFramework(id = " JUnit4 " ,displayName = " JUnit4" ) {
379
382
private val parametrizedTestsNotSupportedError: Nothing
380
383
get() = error(" Parametrized tests are not supported for JUnit4" )
381
384
@@ -448,7 +451,7 @@ object Junit4 : TestFramework("JUnit4") {
448
451
}
449
452
}
450
453
451
- object Junit5 : TestFramework(" JUnit5" ) {
454
+ object Junit5 : TestFramework(id = " JUnit5 " , displayName = " JUnit5" ) {
452
455
override val mainPackage: String = JUNIT5_PACKAGE
453
456
override val testAnnotation = " @$mainPackage .Test"
454
457
override val testAnnotationFqn: String = " $mainPackage .Test"
@@ -589,20 +592,23 @@ object Junit5 : TestFramework("JUnit5") {
589
592
}
590
593
591
594
enum class RuntimeExceptionTestsBehaviour (
595
+ override val id : String ,
592
596
override val displayName : String ,
593
597
override val description : String
594
598
) : CodeGenerationSettingItem {
595
599
PASS (
600
+ id = " Passing" ,
596
601
displayName = " Pass" ,
597
602
description = " Tests that produce Runtime exceptions should pass (by inserting throwable assertion)"
598
603
),
599
604
FAIL (
605
+ id = " Failing" ,
600
606
displayName = " Fail" ,
601
607
description = " Tests that produce Runtime exceptions should fail" +
602
608
" (WARNING!: failing tests may appear in testing class)"
603
609
);
604
610
605
- override fun toString (): String = displayName
611
+ override fun toString (): String = id
606
612
607
613
// Get is mandatory because of the initialization order of the inheritors.
608
614
// Otherwise, in some cases we could get an incorrect value
@@ -623,11 +629,13 @@ data class HangingTestsTimeout(val timeoutMs: Long) {
623
629
}
624
630
625
631
enum class ForceStaticMocking (
632
+ override val id : String ,
626
633
override val displayName : String ,
627
634
override val description : String ,
628
635
val warningMessage : List <String >,
629
636
) : CodeGenerationSettingItem {
630
637
FORCE (
638
+ id = " Force static mocking" ,
631
639
displayName = " Force static mocking" ,
632
640
description = " Use mocks for static methods and constructors invocations even if static mocking is disabled" +
633
641
" (WARNING!: can add imports from missing dependencies)" ,
@@ -638,6 +646,7 @@ enum class ForceStaticMocking(
638
646
)
639
647
),
640
648
DO_NOT_FORCE (
649
+ id = " Do not force static mocking" ,
641
650
displayName = " Do not force static mocking" ,
642
651
description = " Do not force static mocking if static mocking setting is disabled" +
643
652
" (WARNING!: flaky tests can appear)" ,
@@ -647,7 +656,7 @@ enum class ForceStaticMocking(
647
656
)
648
657
);
649
658
650
- override fun toString (): String = displayName
659
+ override fun toString (): String = id
651
660
652
661
// Get is mandatory because of the initialization order of the inheritors.
653
662
// Otherwise, in some cases we could get an incorrect value
@@ -658,19 +667,22 @@ enum class ForceStaticMocking(
658
667
}
659
668
660
669
enum class ParametrizedTestSource (
670
+ override val id : String ,
661
671
override val displayName : String ,
662
672
override val description : String = " Use $displayName for parametrized tests"
663
673
) : CodeGenerationSettingItem {
664
674
DO_NOT_PARAMETRIZE (
675
+ id = " Not parametrized" ,
665
676
displayName = " Not parametrized" ,
666
677
description = " Do not generate parametrized tests"
667
678
),
668
679
PARAMETRIZE (
680
+ id = " Parametrized" ,
669
681
displayName = " Parametrized" ,
670
682
description = " Generate parametrized tests"
671
683
);
672
684
673
- override fun toString (): String = displayName
685
+ override fun toString (): String = id
674
686
675
687
// Get is mandatory because of the initialization order of the inheritors.
676
688
// Otherwise, in some cases we could get an incorrect value
0 commit comments