Skip to content

Commit 16e9862

Browse files
committed
Add some documentation
1 parent 6f0fb42 commit 16e9862

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ class WildcardTypeParameter : TypeParameters(emptyList())
11511151
/**
11521152
* A context to use when no specific data is required.
11531153
*/
1154-
open class ApplicationContext(
1154+
open class StandardApplicationContext(
11551155
val mockFrameworkInstalled: Boolean = true,
11561156
val staticsMockingIsConfigured: Boolean = true,
11571157
)
@@ -1166,7 +1166,7 @@ class SpringApplicationContext(
11661166
mockInstalled: Boolean,
11671167
staticsMockingIsConfigured: Boolean,
11681168
val beanQualifiedNames: List<String> = emptyList(),
1169-
): ApplicationContext(mockInstalled, staticsMockingIsConfigured) {
1169+
): StandardApplicationContext(mockInstalled, staticsMockingIsConfigured) {
11701170
private val springInjectedClasses: List<ClassId> by lazy {
11711171
beanQualifiedNames.map { fqn -> utContext.classLoader.loadClass(fqn).id }
11721172
}

utbot-framework/src/main/kotlin/org/utbot/engine/Mocks.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import kotlinx.collections.immutable.persistentListOf
1919
import org.utbot.common.nameOfPackage
2020
import org.utbot.engine.types.OBJECT_TYPE
2121
import org.utbot.engine.util.mockListeners.MockListenerController
22-
import org.utbot.framework.plugin.api.ApplicationContext
22+
import org.utbot.framework.plugin.api.StandardApplicationContext
2323
import org.utbot.framework.plugin.api.util.isInaccessibleViaReflection
2424
import soot.BooleanType
2525
import soot.RefType
@@ -157,10 +157,14 @@ class Mocker(
157157
private val hierarchy: Hierarchy,
158158
chosenClassesToMockAlways: Set<ClassId>,
159159
internal val mockListenerController: MockListenerController? = null,
160-
private val applicationContext: ApplicationContext,
160+
private val applicationContext: StandardApplicationContext,
161161
) {
162162
private val mocksAreDesired: Boolean = strategy != MockStrategy.NO_MOCKS
163163

164+
/**
165+
* Constructs [MockedObjectInfo]: enriches given value with
166+
* an information if this mock is expected or not.
167+
*/
164168
fun construct(value: ObjectValue?, mockInfo: UtMockInfo): MockedObjectInfo {
165169
return value
166170
?.let {
@@ -183,8 +187,8 @@ class Mocker(
183187
}
184188

185189
/**
186-
* Creates mocked instance of the [type] using mock info if it should be mocked by the mocker,
187-
* otherwise returns null.
190+
* Creates mocked instance (if it should be mocked by the mocker) of the [type] using [mockInfo]
191+
* otherwise returns [NoMock].
188192
*
189193
* @see shouldMock
190194
*/
@@ -194,8 +198,8 @@ class Mocker(
194198
}
195199

196200
/**
197-
* Creates mocked instance of the [type] using mock info. Unlike to [mock], it does not
198-
* check anything and always returns the constructed mock.
201+
* Creates mocked instance of the [type] using [mockInfo]
202+
* it does not check anything and always returns the constructed mock.
199203
*/
200204
fun forceMock(type: RefType, mockInfo: UtMockInfo): MockedObjectInfo {
201205
mockListenerController?.onShouldMock(strategy, mockInfo)

utbot-framework/src/main/kotlin/org/utbot/engine/Traverser.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ import org.utbot.framework.UtSettings
116116
import org.utbot.framework.UtSettings.maximizeCoverageUsingReflection
117117
import org.utbot.framework.UtSettings.preferredCexOption
118118
import org.utbot.framework.UtSettings.substituteStaticsWithSymbolicVariable
119-
import org.utbot.framework.plugin.api.ApplicationContext
119+
import org.utbot.framework.plugin.api.StandardApplicationContext
120120
import org.utbot.framework.plugin.api.ClassId
121121
import org.utbot.framework.plugin.api.ExecutableId
122122
import org.utbot.framework.plugin.api.FieldId
@@ -240,7 +240,7 @@ class Traverser(
240240
internal val typeResolver: TypeResolver,
241241
private val globalGraph: InterProceduralUnitGraph,
242242
private val mocker: Mocker,
243-
private val applicationContext: ApplicationContext?,
243+
private val applicationContext: StandardApplicationContext?,
244244
) : UtContextInitializer() {
245245

246246
private val visitedStmts: MutableSet<Stmt> = mutableSetOf()

utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class UtBotSymbolicEngine(
105105
dependencyPaths: String,
106106
val mockStrategy: MockStrategy = NO_MOCKS,
107107
chosenClassesToMockAlways: Set<ClassId>,
108-
applicationContext: ApplicationContext,
108+
applicationContext: StandardApplicationContext,
109109
private val solverTimeoutInMillis: Int = checkSolverTimeoutMillis
110110
) : UtContextInitializer() {
111111
private val graph = methodUnderTest.sootMethod.jimpleBody().apply {

utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestCaseGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ open class TestCaseGenerator(
6161
val engineActions: MutableList<(UtBotSymbolicEngine) -> Unit> = mutableListOf(),
6262
val isCanceled: () -> Boolean = { false },
6363
val forceSootReload: Boolean = true,
64-
val applicationContext: ApplicationContext = ApplicationContext(),
64+
val applicationContext: StandardApplicationContext = StandardApplicationContext(),
6565
) {
6666
private val logger: KLogger = KotlinLogging.logger {}
6767
private val timeoutLogger: KLogger = KotlinLogging.logger(logger.name + ".timeout")
@@ -257,7 +257,7 @@ open class TestCaseGenerator(
257257
method: ExecutableId,
258258
mockStrategyApi: MockStrategyApi,
259259
chosenClassesToMockAlways: Set<ClassId>,
260-
applicationContext: ApplicationContext,
260+
applicationContext: StandardApplicationContext,
261261
executionTimeEstimator: ExecutionTimeEstimator
262262
): UtBotSymbolicEngine {
263263
logger.debug("Starting symbolic execution for $method --$mockStrategyApi--")

utbot-framework/src/main/kotlin/org/utbot/framework/process/EngineProcessMain.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private fun EngineProcessModel.setup(kryoHelper: KryoHelper, watchdog: IdleWatch
8080
watchdog.measureTimeForActiveCall(createTestGenerator, "Creating Test Generator") { params ->
8181
AnalyticsConfigureUtil.configureML()
8282
Instrumenter.adapter = RdInstrumenter(realProtocol.rdInstrumenterAdapter)
83-
val applicationContext: ApplicationContext = kryoHelper.readObject(params.applicationContext)
83+
val applicationContext: StandardApplicationContext = kryoHelper.readObject(params.applicationContext)
8484

8585
testGenerator = TestCaseGenerator(buildDirs = params.buildDir.map { Paths.get(it) },
8686
classpath = params.classpath,
@@ -98,7 +98,7 @@ private fun EngineProcessModel.setup(kryoHelper: KryoHelper, watchdog: IdleWatch
9898
logger.debug().measureTime({ "starting generation for ${methods.size} methods, starting with ${methods.first()}" }) {
9999
val generateFlow = when (testGenerator.applicationContext) {
100100
is SpringApplicationContext -> defaultSpringFlow(params.generationTimeout)
101-
is ApplicationContext -> testFlow {
101+
is StandardApplicationContext -> testFlow {
102102
generationTimeout = params.generationTimeout
103103
isSymbolicEngineEnabled = params.isSymbolicEngineEnabled
104104
isFuzzingEnabled = params.isFuzzingEnabled

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/generator/UtTestsDialogProcessor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.utbot.framework.CancellationStrategyType.NONE
2626
import org.utbot.framework.CancellationStrategyType.SAVE_PROCESSED_RESULTS
2727
import org.utbot.framework.UtSettings
2828
import org.utbot.framework.plugin.api.ClassId
29-
import org.utbot.framework.plugin.api.ApplicationContext
29+
import org.utbot.framework.plugin.api.StandardApplicationContext
3030
import org.utbot.framework.plugin.api.JavaDocCommentStyle
3131
import org.utbot.framework.plugin.api.util.LockFile
3232
import org.utbot.framework.plugin.api.util.withStaticsSubstitutionRequired
@@ -170,7 +170,7 @@ object UtTestsDialogProcessor {
170170
}.toMap()
171171
}
172172

173-
val applicationContext = ApplicationContext(
173+
val applicationContext = StandardApplicationContext(
174174
model.mockFramework.isInstalled,
175175
model.staticsMocking.isConfigured,
176176
)

0 commit comments

Comments
 (0)