Skip to content

Commit 1c64686

Browse files
Move test environment to separate package
1 parent 7e56b3c commit 1c64686

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

java-tests/validating/src/test/kotlin/io/spine/test/options/goes/GoesMutualITest.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
package io.spine.test.options.goes
2828

2929
import com.google.protobuf.Message
30+
import io.spine.test.options.goes.given.newBuilder
31+
import io.spine.test.options.goes.given.protoDescriptor
32+
import io.spine.test.options.goes.given.protoValue
3033
import io.spine.validate.ValidationException
3134
import org.junit.jupiter.api.DisplayName
3235
import org.junit.jupiter.api.assertDoesNotThrow
@@ -48,7 +51,7 @@ import org.junit.jupiter.params.provider.MethodSource
4851
internal class GoesMutualITest {
4952

5053
@Suppress("MaxLineLength") // So not to wrap the test display name.
51-
@MethodSource("io.spine.test.options.goes.TestDataMutual#interdependentFields")
54+
@MethodSource("io.spine.test.options.goes.given.GoesMutualTestEnv#interdependentFields")
5255
@ParameterizedTest(name = "throw if one of mutually dependent `{1}` and `{3}` fields is not set")
5356
fun throwIfOneOfMutuallyDependentFieldsNotSet(
5457
message: Class<out Message>,
@@ -74,7 +77,7 @@ internal class GoesMutualITest {
7477
}
7578
}
7679

77-
@MethodSource("io.spine.test.options.goes.TestDataMutual#interdependentFields")
80+
@MethodSource("io.spine.test.options.goes.given.GoesMutualTestEnv#interdependentFields")
7881
@ParameterizedTest(name = "pass if both mutually dependent `{1}` and `{3}` fields are set")
7982
fun passIfBothMutuallyDependentFieldsSet(
8083
message: Class<out Message>,
@@ -96,7 +99,7 @@ internal class GoesMutualITest {
9699
}
97100
}
98101

99-
@MethodSource("io.spine.test.options.goes.TestDataMutual#messagesWithInterdependentFields")
102+
@MethodSource("io.spine.test.options.goes.given.GoesMutualTestEnv#messagesWithInterdependentFields")
100103
@ParameterizedTest(name = "pass if both mutually dependent fields are not set")
101104
fun passIfBothMutuallyDependentFieldsNotSet(message: Class<out Message>) {
102105
assertDoesNotThrow {

java-tests/validating/src/test/kotlin/io/spine/test/options/goes/GoesOneWayITest.kt

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
package io.spine.test.options.goes
2828

2929
import com.google.protobuf.Message
30+
import io.spine.test.options.goes.given.newBuilder
31+
import io.spine.test.options.goes.given.protoDescriptor
32+
import io.spine.test.options.goes.given.protoValue
3033
import io.spine.validate.ValidationException
3134
import org.junit.jupiter.api.DisplayName
3235
import org.junit.jupiter.api.assertDoesNotThrow
@@ -47,7 +50,7 @@ import org.junit.jupiter.params.provider.MethodSource
4750
@DisplayName("`(goes)` constraint should")
4851
internal class GoesOneWayITest {
4952

50-
@MethodSource("io.spine.test.options.goes.TestDataOneWay#onlyTargetFields")
53+
@MethodSource("io.spine.test.options.goes.given.GoesOneWayTestEnv#onlyTargetFields")
5154
@ParameterizedTest(name = "throw if only the target `{1}` field is set")
5255
fun throwIfOnlyTargetFieldSet(message: Class<Message>, fieldName: String, fieldValue: Any) {
5356
val descriptor = message.protoDescriptor()
@@ -60,7 +63,7 @@ internal class GoesOneWayITest {
6063
}
6164
}
6265

63-
@MethodSource("io.spine.test.options.goes.TestDataOneWay#onlyCompanionFields")
66+
@MethodSource("io.spine.test.options.goes.given.GoesOneWayTestEnv#onlyCompanionFields")
6467
@ParameterizedTest(name = "pass if only the companion `{1}` field is set")
6568
fun passIfOnlyCompanionFieldSet(
6669
message: Class<out Message>,
@@ -78,7 +81,7 @@ internal class GoesOneWayITest {
7881
}
7982

8083
@Suppress("MaxLineLength") // So not to wrap the test name.
81-
@MethodSource("io.spine.test.options.goes.TestDataOneWay#bothTargetAndCompanionFields")
84+
@MethodSource("io.spine.test.options.goes.given.GoesOneWayTestEnv#bothTargetAndCompanionFields")
8285
@ParameterizedTest(name = "pass if both the target `{1}` and its companion `{3}` fields are set")
8386
fun passIfBothTargetAndCompanionFieldsSet(
8487
message: Class<out Message>,

java-tests/validating/src/test/kotlin/io/spine/test/options/goes/TestDataMutual.kt java-tests/validating/src/test/kotlin/io/spine/test/options/goes/given/GoesMutualTestEnv.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
package io.spine.test.options.goes
27+
package io.spine.test.options.goes.given
2828

2929
import com.google.protobuf.ByteString
3030
import com.google.protobuf.Message
@@ -44,7 +44,7 @@ import org.junit.jupiter.params.provider.Arguments.arguments
4444
* Provides data for parameterized [GoesMutualITest].
4545
*/
4646
@Suppress("unused") // Data provider for parameterized test.
47-
internal object TestDataMutual {
47+
internal object GoesMutualTestEnv {
4848

4949
private val fieldValues = listOf(
5050
MutualMessageCompanion::class to Timestamps.now(),

java-tests/validating/src/test/kotlin/io/spine/test/options/goes/TestDataOneWay.kt java-tests/validating/src/test/kotlin/io/spine/test/options/goes/given/GoesOneWayTestEnv.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
package io.spine.test.options.goes
27+
package io.spine.test.options.goes.given
2828

2929
import com.google.protobuf.ByteString.copyFromUtf8
3030
import com.google.protobuf.Message
@@ -44,7 +44,7 @@ import org.junit.jupiter.params.provider.Arguments.arguments
4444
* Provides data for parameterized [GoesOneWayITest].
4545
*/
4646
@Suppress("unused") // Data provider for parameterized test.
47-
internal object TestDataOneWay {
47+
internal object GoesOneWayTestEnv {
4848

4949
private const val COMPANION_FIELD_NAME = "companion"
5050
private val fieldValues = listOf(

java-tests/validating/src/test/kotlin/io/spine/test/options/goes/TestEnv.kt java-tests/validating/src/test/kotlin/io/spine/test/options/goes/given/GoesTestEnv.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
*/
2626

27-
package io.spine.test.options.goes
27+
package io.spine.test.options.goes.given
2828

2929
import com.google.protobuf.Descriptors.Descriptor
3030
import com.google.protobuf.Descriptors.FieldDescriptor

0 commit comments

Comments
 (0)