-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#337 - output fixed in case of an incorrect arguments count in th cus… (
#338) Output fixed in case of an incorrect arguments count in the custom scenario DSL
- Loading branch information
1 parent
11eefac
commit df8d638
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../kotlinx/lincheck_test/representation/IncorrectArgumentsCountInCustomScenarioActorTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Lincheck | ||
* | ||
* Copyright (C) 2019 - 2024 JetBrains s.r.o. | ||
* | ||
* This Source Code Form is subject to the terms of the | ||
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed | ||
* with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.jetbrains.kotlinx.lincheck_test.representation | ||
|
||
import org.jetbrains.kotlinx.lincheck.annotations.Operation | ||
import org.jetbrains.kotlinx.lincheck.strategy.managed.modelchecking.ModelCheckingOptions | ||
import org.jetbrains.kotlinx.lincheck_test.util.checkFailsWithException | ||
import org.junit.Assert | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
|
||
class IncorrectArgumentsCountInCustomScenarioActorTest { | ||
|
||
@Operation | ||
fun operation(value: Int) = Unit | ||
|
||
@Test | ||
fun testTooFew() { | ||
val exception = Assert.assertThrows(IllegalArgumentException::class.java) { | ||
ModelCheckingOptions() | ||
.addCustomScenario { | ||
parallel { thread { actor(::operation) } } | ||
} | ||
} | ||
assertEquals("Invalid number of the operation operation parameters: 1 expected, 0 provided.", exception.message) | ||
} | ||
|
||
@Test | ||
fun testTooMany() { | ||
val exception = Assert.assertThrows(IllegalArgumentException::class.java) { | ||
ModelCheckingOptions() | ||
.addCustomScenario { | ||
parallel { thread { actor(::operation, 1, 2) } } | ||
} | ||
} | ||
assertEquals("Invalid number of the operation operation parameters: 1 expected, 2 provided.", exception.message) | ||
} | ||
|
||
} |