From c27efdd2a8bddf710823e43db8e98c08d7fb1962 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 21 Feb 2018 12:51:12 +0100 Subject: [PATCH] jetCheck: update doc, make API more permissive --- .../src/org/jetbrains/jetCheck/ImperativeCommand.java | 11 +++++++---- .../org/jetbrains/jetCheck/StatefulGeneratorTest.java | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/jetCheck/src/org/jetbrains/jetCheck/ImperativeCommand.java b/jetCheck/src/org/jetbrains/jetCheck/ImperativeCommand.java index 9ff37fb3bc94..d8807ae9ad2d 100644 --- a/jetCheck/src/org/jetbrains/jetCheck/ImperativeCommand.java +++ b/jetCheck/src/org/jetbrains/jetCheck/ImperativeCommand.java @@ -101,7 +101,7 @@ public interface ImperativeCommand { * @param command a supplier for a top-level command. This supplier should not have any side effects. * @see #checkScenarios */ - static Generator scenarios(@NotNull Supplier command) { + static Generator scenarios(@NotNull Supplier command) { return Generator.from(data -> new ScenarioImpl(command.get(), data)); } @@ -109,16 +109,19 @@ public interface ImperativeCommand { * Performs a check that the scenarios generated by the given command are successful. Default {@link PropertyChecker} settings are used. * @param command a supplier for a top-level command. This supplier should not have any side effects. */ - static void checkScenarios(@NotNull Supplier command) { + static void checkScenarios(@NotNull Supplier command) { PropertyChecker.forAll(scenarios(command)).shouldHold(Scenario::ensureSuccessful); } /** * An analog of {@link PropertyChecker#recheckingIteration} in the imperative command world. - * Performs a check that the scenario generated by the given command with given seed/sizeHint parameter is successful. + * Performs a check that the scenario generated by the given command is successful with given data (as serialized and printed by {@link PropertyFalsified} exception). * @param command a supplier for a top-level command. This supplier should not have any side effects. + * @deprecated To catch your attention. It's fine to call this method during test debugging, but it should not be committed to version control + * and used in regression tests, because any changes in the test itself or the framework can render the passed data obsolete. + * For regression testing, it's recommended to code the failing scenario explicitly. */ - static void checkScenario(@NotNull String serializedData, @NotNull Supplier command) { + static void checkScenario(@NotNull String serializedData, @NotNull Supplier command) { //noinspection deprecation PropertyChecker.forAll(scenarios(command)).rechecking(serializedData).shouldHold(Scenario::ensureSuccessful); } diff --git a/jetCheck/test/org/jetbrains/jetCheck/StatefulGeneratorTest.java b/jetCheck/test/org/jetbrains/jetCheck/StatefulGeneratorTest.java index 08081f2352ef..82bdc7e69ad5 100644 --- a/jetCheck/test/org/jetbrains/jetCheck/StatefulGeneratorTest.java +++ b/jetCheck/test/org/jetbrains/jetCheck/StatefulGeneratorTest.java @@ -83,6 +83,7 @@ public class StatefulGeneratorTest extends PropertyCheckerTestCase { PropertyFailure failure = e.getFailure(); try { + //noinspection deprecation ImperativeCommand.checkScenario(failure.getMinimalCounterexample().getSerializedData(), command); fail(); }