Skip to content

Move test-specific implementation #1327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 14, 2022
Merged
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ include("utbot-gradle")
include("utbot-maven")
include("utbot-summary-tests")
include("utbot-framework-test")
include("utbot-testing")
include("utbot-rd")
include("utbot-android-studio")

Expand Down
1 change: 1 addition & 0 deletions utbot-analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies {
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.9'
implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.22.1'

testImplementation project(':utbot-testing')
testImplementation project(':utbot-framework').sourceSets.test.output
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class FeatureProcessorWithStatesRepetition(
}
}

internal class RewardEstimator {
class RewardEstimator {

fun calculateRewards(testCases: List<TestCase>): Map<Int, Double> {
val rewards = mutableMapOf<Int, Double>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.utbot.analytics.EngineAnalyticsContext
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.withFeaturePath
import org.utbot.testing.UtValueTestCaseChecker
import java.io.File
import java.io.FileInputStream

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ inline fun UtExecutionResult.onFailure(action: (exception: Throwable) -> Unit):
return this
}

fun UtExecutionResult.getOrThrow(): UtModel = when (this) {
is UtExecutionSuccess -> model
is UtExecutionFailure -> throw exception
}

fun UtExecutionResult.exceptionOrNull(): Throwable? = when (this) {
is UtExecutionFailure -> rootCauseException
is UtExecutionSuccess -> null
Expand Down
1 change: 1 addition & 0 deletions utbot-framework-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ configurations {

dependencies {
api project(':utbot-framework-api')
testImplementation project(':utbot-testing')

api project(':utbot-fuzzers')
api project(':utbot-instrumentation')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.utbot.examples.algorithms

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.utbot.framework.plugin.api.DocCodeStmt
import org.utbot.framework.plugin.api.DocPreTagStatement
import org.utbot.framework.plugin.api.DocRegularStmt
import org.utbot.framework.plugin.api.DocStatement
import org.junit.jupiter.api.Test
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException

class BinarySearchTest : UtValueTestCaseChecker(testClass = BinarySearch::class,) {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.utbot.examples.algorithms

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.examples.algorithms.CorrectBracketSequences.isBracket
import org.utbot.examples.algorithms.CorrectBracketSequences.isOpen
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.utbot.tests.infrastructure.keyMatch
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.framework.plugin.api.DocCodeStmt
import org.utbot.framework.plugin.api.DocPreTagStatement
import org.utbot.framework.plugin.api.DocRegularStmt
import org.junit.jupiter.api.Test
import org.utbot.examples.algorithms.CorrectBracketSequences.isBracket
import org.utbot.examples.algorithms.CorrectBracketSequences.isOpen
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException
import org.utbot.testing.keyMatch

internal class CorrectBracketSequencesTest : UtValueTestCaseChecker(
testClass = CorrectBracketSequences::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.utbot.examples.algorithms

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException

internal class GraphTest : UtValueTestCaseChecker(testClass = GraphExample::class) {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package org.utbot.examples.algorithms

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.utbot.tests.infrastructure.keyMatch
import org.utbot.framework.plugin.api.DocCodeStmt
import org.utbot.framework.plugin.api.DocPreTagStatement
import org.utbot.framework.plugin.api.DocRegularStmt
Expand All @@ -12,7 +8,11 @@ import org.junit.jupiter.api.Test
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.ge
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException
import org.utbot.testing.keyMatch

// TODO Kotlin mocks generics https://github.com/UnitTestBot/UTBotJava/issues/88
internal class SortTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.utbot.examples.annotations

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testing.UtValueTestCaseChecker

internal class NotNullAnnotationTest : UtValueTestCaseChecker(testClass = NotNullAnnotation::class) {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.utbot.examples.annotations.lombok

import org.junit.jupiter.api.Test
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.testcheckers.eq
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker

/**
* Tests for Lombok annotations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.utbot.examples.annotations.lombok

import org.junit.jupiter.api.Test
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.testcheckers.eq
import org.utbot.testing.UtValueTestCaseChecker

internal class EnumWithoutAnnotationsTest : UtValueTestCaseChecker(testClass = EnumWithoutAnnotations::class) {
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package org.utbot.examples.annotations.lombok

import org.junit.jupiter.api.Test
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.testcheckers.eq
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker

/**
* Tests for Lombok NonNull annotation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.utbot.examples.arrays

import org.junit.jupiter.api.Disabled
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.atLeast
import org.utbot.examples.casts.ColoredPoint
import org.utbot.examples.casts.Point
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.withoutMinimization
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.atLeast
import org.utbot.testing.ignoreExecutionsNumber

@Suppress("NestedLambdaShadowedImplicitParameter")
internal class ArrayOfArraysTest : UtValueTestCaseChecker(testClass = ArrayOfArrays::class) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.utbot.examples.arrays

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.atLeast
import org.utbot.tests.infrastructure.between
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.ge
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.atLeast
import org.utbot.testing.between
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException

// TODO failed Kotlin compilation SAT-1332
internal class ArrayOfObjectsTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.AtLeast
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.isException
import org.utbot.testing.AtLeast
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.isException

class ArrayStoreExceptionExamplesTest : UtValueTestCaseChecker(
testClass = ArrayStoreExceptionExamples::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.utbot.examples.arrays

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker

// TODO failed Kotlin compilation SAT-1332
class ArraysOverwriteValueTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.utbot.examples.arrays

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.junit.jupiter.api.Test
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber

internal class FinalStaticFieldArrayTest : UtValueTestCaseChecker(testClass = FinalStaticFieldArray::class) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.utbot.examples.arrays

import org.junit.jupiter.api.Disabled
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.tests.infrastructure.isException
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.ge
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber
import org.utbot.testing.isException

// TODO failed Kotlin compilation SAT-1332
internal class IntArrayBasicsTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.utbot.examples.arrays

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.atLeast
import org.utbot.tests.infrastructure.isException
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.atLeast
import org.utbot.testing.isException

// TODO failed Kotlin compilation SAT-1332
internal class PrimitiveArraysTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.utbot.examples.casts

import org.junit.jupiter.api.Disabled
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker

// TODO failed Kotlin compilation (generics) SAT-1332
//TODO: SAT-1487 calculate coverage for all methods of this test class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.utbot.examples.casts

import org.junit.jupiter.api.Test
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.framework.plugin.api.CodegenLanguage
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker

internal class CastClassTest : UtValueTestCaseChecker(
testClass = CastClass::class,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.utbot.examples.casts

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.isException
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.isException

// TODO failed Kotlin compilation SAT-1332
internal class CastExampleTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.utbot.examples.casts

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.between
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.between

// TODO failed Kotlin compilation SAT-1332
internal class GenericCastExampleTest : UtValueTestCaseChecker(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.utbot.examples.casts

import org.utbot.tests.infrastructure.UtValueTestCaseChecker
import org.utbot.tests.infrastructure.DoNotCalculate
import org.utbot.tests.infrastructure.ignoreExecutionsNumber
import org.utbot.framework.plugin.api.CodegenLanguage
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.utbot.testcheckers.eq
import org.utbot.testcheckers.ge
import org.utbot.tests.infrastructure.CodeGeneration
import org.utbot.testing.CodeGeneration
import org.utbot.testing.DoNotCalculate
import org.utbot.testing.UtValueTestCaseChecker
import org.utbot.testing.ignoreExecutionsNumber

// TODO failed Kotlin compilation SAT-1332
internal class InstanceOfExampleTest : UtValueTestCaseChecker(
Expand Down
Loading