Skip to content

Commit 4c6d73b

Browse files
authored
Rename mock strategy options in the gradle and maven plugins (#369)
1 parent b737f40 commit 4c6d73b

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/sarif/SarifExtensionProvider.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ interface SarifExtensionProvider {
9393

9494
fun mockStrategyParse(mockStrategy: String): MockStrategyApi =
9595
when (mockStrategy.toLowerCase()) {
96-
"do-not-mock" -> MockStrategyApi.NO_MOCKS
97-
"package-based" -> MockStrategyApi.OTHER_PACKAGES
98-
"all-except-cut" -> MockStrategyApi.OTHER_CLASSES
99-
else -> error("Parameter mockStrategy == '$mockStrategy', but it can take only 'do-not-mock', 'package-based' or 'all-except-cut'")
96+
"no-mocks" -> MockStrategyApi.NO_MOCKS
97+
"other-packages" -> MockStrategyApi.OTHER_PACKAGES
98+
"other-classes" -> MockStrategyApi.OTHER_CLASSES
99+
else -> error("Parameter mockStrategy == '$mockStrategy', but it can take only 'no-mocks', 'other-packages' or 'other-classes'")
100100
}
101101

102102
fun staticsMockingParse(staticsMocking: String): StaticsMocking =

utbot-gradle/docs/utbot-gradle.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ __Groovy:__
4444
mockFramework = 'mockito'
4545
generationTimeout = 60000L
4646
codegenLanguage = 'java'
47-
mockStrategy = 'package-based'
47+
mockStrategy = 'other-packages'
4848
staticsMocking = 'mock-statics'
4949
forceStaticMocking = 'force'
5050
classesToMockAlways = ['org.slf4j.Logger', 'java.util.Random']
@@ -62,7 +62,7 @@ __Kotlin DSL:__
6262
mockFramework.set("mockito")
6363
generationTimeout.set(60000L)
6464
codegenLanguage.set("java")
65-
mockStrategy.set("package-based")
65+
mockStrategy.set("other-packages")
6666
staticsMocking.set("mock-statics")
6767
forceStaticMocking.set("force")
6868
classesToMockAlways.set(listOf("org.slf4j.Logger", "java.util.Random"))
@@ -118,9 +118,9 @@ __Kotlin DSL:__
118118
- `mockStrategy` –
119119
- The mock strategy to be used.
120120
- Can be one of:
121-
- `'do-not-mock'` – do not use mock frameworks at all
122-
- `'package-based'` – mock all classes outside the current package except system ones _(by default)_
123-
- `'all-except-cut'` – mock all classes outside the class under test except system ones
121+
- `'no-mocks'` – do not use mock frameworks at all
122+
- `'other-packages'` – mock all classes outside the current package except system ones _(by default)_
123+
- `'other-classes'` – mock all classes outside the class under test except system ones
124124

125125
- `staticsMocking` –
126126
- Use static methods mocking or not.

utbot-gradle/src/main/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtension.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class SarifGradleExtension {
6868
abstract val codegenLanguage: Property<String>
6969

7070
/**
71-
* Can be one of: 'do-not-mock', 'package-based', 'all-except-cut'.
71+
* Can be one of: 'no-mocks', 'other-packages', 'other-classes'.
7272
*/
7373
@get:Input
7474
abstract val mockStrategy: Property<String>
@@ -105,7 +105,7 @@ sarifReport {
105105
mockFramework = 'mockito'
106106
generationTimeout = 60 * 1000L
107107
codegenLanguage = 'java'
108-
mockStrategy = 'do-not-mock'
108+
mockStrategy = 'no-mocks'
109109
staticsMocking = 'do-not-mock-statics'
110110
forceStaticMocking = 'force'
111111
classesToMockAlways = ['org.utbot.api.mock.UtMock']

utbot-gradle/src/test/kotlin/org/utbot/gradle/plugin/extension/SarifGradleExtensionProviderTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,19 +256,19 @@ class SarifGradleExtensionProviderTest {
256256

257257
@Test
258258
fun `should be equal to NO_MOCKS`() {
259-
setMockStrategy("do-not-mock")
259+
setMockStrategy("no-mocks")
260260
assertEquals(MockStrategyApi.NO_MOCKS, extensionProvider.mockStrategy)
261261
}
262262

263263
@Test
264264
fun `should be equal to OTHER_PACKAGES`() {
265-
setMockStrategy("package-based")
265+
setMockStrategy("other-packages")
266266
assertEquals(MockStrategyApi.OTHER_PACKAGES, extensionProvider.mockStrategy)
267267
}
268268

269269
@Test
270270
fun `should be equal to OTHER_CLASSES`() {
271-
setMockStrategy("all-except-cut")
271+
setMockStrategy("other-classes")
272272
assertEquals(MockStrategyApi.OTHER_CLASSES, extensionProvider.mockStrategy)
273273
}
274274

utbot-maven/docs/utbot-maven.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For example, the following configuration may be used:
4444
<mockFramework>mockito</mockFramework>
4545
<generationTimeout>60000L</generationTimeout>
4646
<codegenLanguage>java</codegenLanguage>
47-
<mockStrategy>package-based</mockStrategy>
47+
<mockStrategy>other-packages</mockStrategy>
4848
<staticsMocking>mock-statics</staticsMocking>
4949
<forceStaticMocking>force</forceStaticMocking>
5050
<classesToMockAlways>
@@ -104,9 +104,9 @@ For example, the following configuration may be used:
104104
- `mockStrategy` &ndash;
105105
- The mock strategy to be used.
106106
- Can be one of:
107-
- `'do-not-mock'` &ndash; do not use mock frameworks at all
108-
- `'package-based'` &ndash; mock all classes outside the current package except system ones _(by default)_
109-
- `'all-except-cut'` &ndash; mock all classes outside the class under test except system ones
107+
- `'no-mocks'` &ndash; do not use mock frameworks at all
108+
- `'other-packages'` &ndash; mock all classes outside the current package except system ones _(by default)_
109+
- `'other-classes'` &ndash; mock all classes outside the class under test except system ones
110110

111111
- `staticsMocking` &ndash;
112112
- Use static methods mocking or not.

utbot-maven/src/main/kotlin/org/utbot/maven/plugin/GenerateTestsAndSarifReportMojo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ class GenerateTestsAndSarifReportMojo : AbstractMojo() {
9696
internal lateinit var codegenLanguage: String
9797

9898
/**
99-
* Can be one of: 'do-not-mock', 'package-based', 'all-except-cut'.
99+
* Can be one of: 'no-mocks', 'other-packages', 'other-classes'.
100100
*/
101-
@Parameter(defaultValue = "do-not-mock")
101+
@Parameter(defaultValue = "no-mocks")
102102
internal lateinit var mockStrategy: String
103103

104104
/**

utbot-maven/src/test/resources/project-to-test/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<mockFramework>mockito</mockFramework>
3535
<generationTimeout>10000</generationTimeout>
3636
<codegenLanguage>java</codegenLanguage>
37-
<mockStrategy>package-based</mockStrategy>
37+
<mockStrategy>other-packages</mockStrategy>
3838
<staticsMocking>mock-statics</staticsMocking>
3939
<forceStaticMocking>force</forceStaticMocking>
4040
<classesToMockAlways>

0 commit comments

Comments
 (0)