From 20fd375c37f87d17b5132470930e715eb3d3da55 Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Sun, 19 Jan 2020 13:30:19 +0300 Subject: [PATCH] Split API and engine fixes #254 --- core-api/pom.xml | 78 +++++++ .../com/pholser/junit/quickcheck/From.java | 4 +- .../GeneratorConfigurationException.java | 4 +- .../quickcheck/MinimalCounterexampleHook.java | 0 .../com/pholser/junit/quickcheck/Mode.java | 18 +- .../com/pholser/junit/quickcheck/Pair.java | 4 +- .../pholser/junit/quickcheck/Produced.java | 4 +- .../pholser/junit/quickcheck/Property.java | 0 .../com/pholser/junit/quickcheck/When.java | 0 .../conversion/StringConversion.java | 0 .../junit/quickcheck/generator/Also.java | 0 .../generator/ComponentizedGenerator.java | 0 .../junit/quickcheck/generator/Ctor.java | 0 .../junit/quickcheck/generator/Distinct.java | 0 .../junit/quickcheck/generator/Fields.java | 0 .../junit/quickcheck/generator/Gen.java | 0 .../generator/GenerationStatus.java | 0 .../junit/quickcheck/generator/Generator.java | 2 + .../generator/GeneratorConfiguration.java | 0 .../quickcheck/generator/Generators.java | 0 .../quickcheck}/generator/NullAllowed.java | 2 +- .../junit/quickcheck/generator/Only.java | 0 .../junit/quickcheck/generator/Shrink.java | 0 .../junit/quickcheck/generator/Size.java | 0 .../junit/quickcheck/generator/ValuesOf.java | 0 .../hook/NilMinimalCounterexampleHook.java | 0 .../quickcheck/internal/Comparables.java | 0 .../junit/quickcheck/internal/Items.java | 0 .../junit/quickcheck/internal/Reflection.java | 0 .../internal/ReflectionException.java | 0 .../junit/quickcheck/internal/Weighted.java | 0 .../junit/quickcheck/internal/Zilch.java | 0 .../internal/generator/ZilchGenerator.java | 0 .../quickcheck/random/SourceOfRandomness.java | 215 ++++++++++++++++++ .../pholser/junit/quickcheck/Annotations.java | 0 .../quickcheck/internal/ComparablesTest.java | 0 .../internal/InvocationTargetProblematic.java | 0 .../junit/quickcheck/internal/ItemsTest.java | 0 .../MultiArgIllegalAccessProblematic.java | 0 .../quickcheck/internal/ReflectionTest.java | 0 .../ZeroArgIllegalAccessProblematic.java | 0 .../quickcheck/test/generator/ABigInt.java | 0 .../quickcheck/test/generator/ABool.java | 0 .../junit/quickcheck/test/generator/ABox.java | 0 .../quickcheck/test/generator/AByte.java | 0 .../quickcheck/test/generator/ACallable.java | 0 .../quickcheck/test/generator/AChar.java | 0 .../quickcheck/test/generator/ADecimal.java | 0 .../quickcheck/test/generator/ADouble.java | 0 .../quickcheck/test/generator/AFloat.java | 0 .../junit/quickcheck/test/generator/AFoo.java | 0 .../test/generator/AFooBadShrinks.java | 0 .../quickcheck/test/generator/AList.java | 0 .../quickcheck/test/generator/ALong.java | 0 .../junit/quickcheck/test/generator/AMap.java | 0 .../quickcheck/test/generator/APair.java | 0 .../quickcheck/test/generator/AShort.java | 0 .../quickcheck/test/generator/AString.java | 0 .../quickcheck/test/generator/AnInt.java | 0 .../quickcheck/test/generator/AnotherBox.java | 0 .../quickcheck/test/generator/Between.java | 0 .../junit/quickcheck/test/generator/Box.java | 4 +- .../junit/quickcheck/test/generator/Foo.java | 0 .../test/generator/FooBoxOpener.java | 0 .../junit/quickcheck/test/generator/Pair.java | 0 .../test/generator/TestGeneratorSource.java | 0 .../junit/quickcheck/test/generator/X.java | 0 core/pom.xml | 20 +- .../junit/quickcheck/generator/Lambdas.java | 3 +- .../internal/generator/ArrayGenerator.java | 2 + .../generator/CompositeGenerator.java | 2 +- .../generator/GeneratorRepository.java | 1 + .../internal/generator/NullableGenerator.java | 1 + .../ServiceLoaderGeneratorSource.java | 1 - ...ss.java => DefaultSourceOfRandomness.java} | 189 +++------------ examples/pom.xml | 16 +- .../examples/geom/PointGenerator.java | 1 - .../examples/geom/PolygonGenerator.java | 2 - .../examples/geom/SegmentGenerator.java | 2 - .../nullable/NullableParameterTest.java | 2 +- generators/pom.xml | 15 +- .../java/util/CollectionGenerator.java | 2 + .../generator/java/util/MapGenerator.java | 2 + .../PrimitivePropertyParameterTypesTest.java | 1 - guava/pom.xml | 20 +- ...ionOfStringToIntPropertyParameterTest.java | 3 +- pom.xml | 98 ++++++-- runner-junit4/pom.xml | 119 ++++++++++ .../quickcheck/runner/JUnitQuickcheck.java | 3 +- .../NoValuesSatisfiedPropertyAssumptions.java | 0 .../quickcheck/runner/PropertyFalsified.java | 0 .../quickcheck/runner/PropertyStatement.java | 3 +- .../quickcheck/runner/PropertyVerifier.java | 0 .../junit/quickcheck/runner/ShrinkNode.java | 0 .../junit/quickcheck/runner/Shrinker.java | 0 .../model/JUnitQuickcheckTestClass.java | 0 ...olser.junit.quickcheck.generator.Generator | 0 .../BasicCapabilitiesOfGeneratorTest.java | 0 .../com/pholser/junit/quickcheck/Classes.java | 0 ...solateConfigurationFromComponentsTest.java | 0 .../junit/quickcheck/ComposedObjectsTest.java | 1 - .../EnumPropertyParameterTypesTest.java | 0 .../EqualsHashCodePropertiesTest.java | 0 ...stingAGivenSetButIncludingAnotherTest.java | 0 .../quickcheck/ExhaustingAGivenSetTest.java | 0 .../quickcheck/FieldMetaAnnotationTest.java | 64 ++++++ .../pholser/junit/quickcheck/FilterTest.java | 0 .../quickcheck/FooEqualsHashCodeTest.java | 0 .../pholser/junit/quickcheck/Functions.java | 3 +- .../GeneratorDescriptorsIssue235.java | 0 .../junit/quickcheck/GeneratorTest.java | 0 ...enericArrayPropertyParameterTypesTest.java | 0 .../LambdaPropertyParameterTypesTest.java | 0 .../com/pholser/junit/quickcheck/Lists.java | 0 .../pholser/junit/quickcheck/LongRunning.java | 0 .../junit/quickcheck/MapFlatMapTest.java | 0 ...opertyParametersWithConfigurationTest.java | 0 .../MinimalCounterexampleHookTest.java | 0 .../com/pholser/junit/quickcheck/Objects.java | 0 .../pholser/junit/quickcheck/PairTest.java | 0 .../PropertiesWithExplicitGeneratorsTest.java | 0 .../PropertyExhaustiveSampleSizeTest.java | 0 ...tyParameterConfigurationIsolationTest.java | 0 .../PropertyParameterDiscardRatioTest.java | 0 ...yParameterGenerationByConstructorTest.java | 0 ...opertyParameterGenerationByFieldsTest.java | 0 ...arkedWithSuperfluousConfigurationTest.java | 1 - .../PropertyTupleSampleSizeTest.java | 0 ...erenceArrayPropertyParameterTypesTest.java | 0 .../pholser/junit/quickcheck/Repro175.java | 0 ...vingGenericPropertyParameterTypesTest.java | 0 ...SamplingButAlsoIncludingAGivenSetTest.java | 2 - .../SamplingOnlyFromAGivenSetTest.java | 0 .../junit/quickcheck/ShrinkingTest.java | 0 .../pholser/junit/quickcheck/TimesTest.java | 0 .../com/pholser/junit/quickcheck/Types.java | 0 ...sualJUnitMachineryOnPropertyBasedTest.java | 0 ...MachineryOnShrinkingPropertyBasedTest.java | 0 ...lJUnitMachineryOnSubclassPropertyTest.java | 0 ...UnitMachineryOnTraitBasedPropertyTest.java | 0 ...tilityClassesUninstantiabilityHarness.java | 0 .../ArrayOfBoxOfHuhPropertyParameterTest.java | 0 .../BoxOfSuperLongPropertyParameterTest.java | 0 .../generator/GenFrequencyTest.java | 0 .../quickcheck/generator/GenOneOfTest.java | 0 ...erationStatusOnPropertyParametersTest.java | 0 .../quickcheck/generator/LambdasTest.java | 3 +- .../generator/LambdasUtilityClassTest.java | 0 ...tiveIntegerArrayPropertyParameterTest.java | 0 ...PropertyParameterGenerationStatusTest.java | 0 ...tiveIntegerArrayPropertyParameterTest.java | 0 .../ThreeDCharArrayPropertyParameterTest.java | 0 .../internal/CartesianIteratorTest.java | 0 .../internal/ComparablesUtilityClassTest.java | 0 ...eAnnotatedTypeFactoryUtilityClassTest.java | 0 .../internal/GeometricDistributionTest.java | 0 .../internal/ItemsUtilityClassTest.java | 0 .../junit/quickcheck/internal/ListsTest.java | 0 .../internal/ListsUtilityClassTest.java | 0 .../junit/quickcheck/internal/RangesTest.java | 5 +- .../internal/RangesUtilityClassTest.java | 0 .../internal/ReflectionUtilityClassTest.java | 0 .../quickcheck/internal/SequencesTest.java | 0 .../internal/SequencesUtilityClassTest.java | 0 .../quickcheck/internal/WeightedTest.java | 0 .../constraint/ConstraintEvaluatorTest.java | 0 .../generator/ArrayGeneratorTest.java | 0 .../generator/CompositeGeneratorTest.java | 0 ...eratorsCanAcceptCertainComponentsTest.java | 0 .../generator/CorePropertyParameterTest.java | 0 .../internal/generator/EnumGeneratorTest.java | 0 ...torsChosenWithDiscreteProbabilityTest.java | 0 ...eratorsChosenWithEqualProbabilityTest.java | 0 ...eratorsChosenWithEqualProbabilityTest.java | 0 .../internal/generator/Generators.java | 0 .../MissingGeneratorForGivenTypeTest.java | 0 .../generator/OneOfSetOfGeneratorsTest.java | 3 +- ...ropertyParameterGenerationContextTest.java | 0 ...nContextWithNonShrinkingGeneratorTest.java | 0 .../RegisterGeneratorsByConvention.java | 0 ...GeneratorsForHierarchyOfArrayListTest.java | 0 ...eneratorsForHierarchyOfBigDecimalTest.java | 0 ...ngGeneratorsForHierarchyOfHashMapTest.java | 0 ...GeneratorsForHierarchyOfInterfaceTest.java | 0 ...teringGeneratorsWithServiceLoaderTest.java | 0 .../conventiontestclasses/Convention.java | 0 .../conventiontestclasses/ConventionGen.java | 0 .../GeneratesOtherTypes.java | 0 .../GeneratesOtherTypesGen.java | 0 .../conventiontestclasses/NotAGenerator.java | 0 .../NotAGeneratorGen.java | 0 ...ndomValuesFromJavaUtilRandomCloneTest.java | 2 +- .../random/GeneratingRandomValuesTest.java | 2 +- .../PropertyFalsifiedUtilityClassTest.java | 0 ...olser.junit.quickcheck.generator.Generator | 0 .../src/test/resources/logback-test.xml | 0 .../subclass-property-test-expected.txt | 0 .../trait-property-test-expected.txt | 0 198 files changed, 663 insertions(+), 266 deletions(-) create mode 100644 core-api/pom.xml rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/From.java (100%) rename {core/src/main/java/com/pholser/junit/quickcheck/generator => core-api/src/main/java/com/pholser/junit/quickcheck}/GeneratorConfigurationException.java (94%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/MinimalCounterexampleHook.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/Mode.java (73%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/Pair.java (96%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/Produced.java (95%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/Property.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/When.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/conversion/StringConversion.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Also.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/ComponentizedGenerator.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Ctor.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Distinct.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Fields.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Gen.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/GenerationStatus.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java (99%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfiguration.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Generators.java (100%) rename {core/src/main/java/com/pholser/junit/quickcheck/internal => core-api/src/main/java/com/pholser/junit/quickcheck}/generator/NullAllowed.java (92%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Only.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Shrink.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/Size.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/generator/ValuesOf.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/hook/NilMinimalCounterexampleHook.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/Comparables.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/Items.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/Reflection.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/ReflectionException.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/Weighted.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/Zilch.java (100%) rename {core => core-api}/src/main/java/com/pholser/junit/quickcheck/internal/generator/ZilchGenerator.java (100%) create mode 100644 core-api/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/Annotations.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesTest.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/InvocationTargetProblematic.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/ItemsTest.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/MultiArgIllegalAccessProblematic.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionTest.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/internal/ZeroArgIllegalAccessProblematic.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ABigInt.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ABool.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ABox.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AByte.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ACallable.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AChar.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ADecimal.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ADouble.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AFloat.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AFoo.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AFooBadShrinks.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AList.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/ALong.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AMap.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/APair.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AShort.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AString.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AnInt.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/AnotherBox.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/Between.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java (95%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/Foo.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/FooBoxOpener.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/Pair.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/TestGeneratorSource.java (100%) rename {core => core-api}/src/test/java/com/pholser/junit/quickcheck/test/generator/X.java (100%) rename core/src/main/java/com/pholser/junit/quickcheck/random/{SourceOfRandomness.java => DefaultSourceOfRandomness.java} (55%) create mode 100644 runner-junit4/pom.xml rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java (96%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/NoValuesSatisfiedPropertyAssumptions.java (100%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/PropertyFalsified.java (100%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java (98%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/PropertyVerifier.java (100%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/ShrinkNode.java (100%) rename {core => runner-junit4}/src/main/java/com/pholser/junit/quickcheck/runner/Shrinker.java (100%) rename {core => runner-junit4}/src/main/java/org/junit/runners/model/JUnitQuickcheckTestClass.java (100%) rename {core => runner-junit4}/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/BasicCapabilitiesOfGeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Classes.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ComponentizedGeneratorsIsolateConfigurationFromComponentsTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java (99%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/EnumPropertyParameterTypesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/EqualsHashCodePropertiesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetButIncludingAnotherTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetTest.java (100%) create mode 100644 runner-junit4/src/test/java/com/pholser/junit/quickcheck/FieldMetaAnnotationTest.java rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/FilterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/FooEqualsHashCodeTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Functions.java (91%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/GeneratorDescriptorsIssue235.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/GeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/GenericArrayPropertyParameterTypesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/LambdaPropertyParameterTypesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Lists.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/LongRunning.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/MapFlatMapTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/MarkingTypeUsesOnPropertyParametersWithConfigurationTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/MinimalCounterexampleHookTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Objects.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PairTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertiesWithExplicitGeneratorsTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyExhaustiveSampleSizeTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyParameterConfigurationIsolationTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyParameterDiscardRatioTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByConstructorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByFieldsTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java (98%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/PropertyTupleSampleSizeTest.java (100%) rename {generators => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ReferenceArrayPropertyParameterTypesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Repro175.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ResolvingGenericPropertyParameterTypesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java (99%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/SamplingOnlyFromAGivenSetTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/ShrinkingTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/TimesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/Types.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnPropertyBasedTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnShrinkingPropertyBasedTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnSubclassPropertyTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnTraitBasedPropertyTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/UtilityClassesUninstantiabilityHarness.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/ArrayOfBoxOfHuhPropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/BoxOfSuperLongPropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/GenFrequencyTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/GenOneOfTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/GenerationStatusOnPropertyParametersTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java (96%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/LambdasUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/PrimitiveIntegerArrayPropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/PropertyParameterGenerationStatusTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/SizeConstrainedPrimitiveIntegerArrayPropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/generator/ThreeDCharArrayPropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/CartesianIteratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactoryUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/GeometricDistributionTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/ItemsUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/ListsTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/ListsUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java (92%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/RangesUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/SequencesTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/SequencesUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/WeightedTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/constraint/ConstraintEvaluatorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/ArrayGeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/CompositeGeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/ConstrainingWhatGeneratorsCanAcceptCertainComponentsTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/CorePropertyParameterTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/EnumGeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithDiscreteProbabilityTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/Generators.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/MissingGeneratorForGivenTypeTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java (96%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextWithNonShrinkingGeneratorTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisterGeneratorsByConvention.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfArrayListTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfBigDecimalTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfHashMapTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfInterfaceTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsWithServiceLoaderTest.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/Convention.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/ConventionGen.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypes.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypesGen.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGenerator.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGeneratorGen.java (100%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java (97%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java (99%) rename {core => runner-junit4}/src/test/java/com/pholser/junit/quickcheck/runner/PropertyFalsifiedUtilityClassTest.java (100%) rename {core => runner-junit4}/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator (100%) rename {core => runner-junit4}/src/test/resources/logback-test.xml (100%) rename {core => runner-junit4}/src/test/resources/subclass-property-test-expected.txt (100%) rename {core => runner-junit4}/src/test/resources/trait-property-test-expected.txt (100%) diff --git a/core-api/pom.xml b/core-api/pom.xml new file mode 100644 index 000000000..952213931 --- /dev/null +++ b/core-api/pom.xml @@ -0,0 +1,78 @@ + + 4.0.0 + + + com.pholser + junit-quickcheck + 0.10-SNAPSHOT + + + junit-quickcheck-core-api + 0.10-SNAPSHOT + jar + junit-quickcheck-core-api + Property-based testing, JUnit-style: core functionality + http://github.com/pholser/junit-quickcheck + + + + org.javaruntype + javaruntype + + + + junit + junit + test + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + org.mockito + mockito-all + test + + + ch.qos.logback + logback-classic + test + + + + + + + org.apache.maven.plugins + maven-release-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + + org.codehaus.mojo + findbugs-maven-plugin + + + + diff --git a/core/src/main/java/com/pholser/junit/quickcheck/From.java b/core-api/src/main/java/com/pholser/junit/quickcheck/From.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/From.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/From.java index b5e8f5ec7..6e1aba627 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/From.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/From.java @@ -29,11 +29,11 @@ a copy of this software and associated documentation files (the import java.lang.annotation.Retention; import java.lang.annotation.Target; -import com.pholser.junit.quickcheck.generator.Generator; - import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.*; +import com.pholser.junit.quickcheck.generator.Generator; + /** *

Mark a parameter of a {@link Property} method with this annotation to * have random values supplied to it via the specified diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfigurationException.java b/core-api/src/main/java/com/pholser/junit/quickcheck/GeneratorConfigurationException.java similarity index 94% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfigurationException.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/GeneratorConfigurationException.java index f96a75845..75ca6e289 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfigurationException.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/GeneratorConfigurationException.java @@ -23,7 +23,9 @@ a copy of this software and associated documentation files (the WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.pholser.junit.quickcheck.generator; +package com.pholser.junit.quickcheck; + +import com.pholser.junit.quickcheck.generator.Generator; /** * Raised if a problem arises when attempting to configure a generator with diff --git a/core/src/main/java/com/pholser/junit/quickcheck/MinimalCounterexampleHook.java b/core-api/src/main/java/com/pholser/junit/quickcheck/MinimalCounterexampleHook.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/MinimalCounterexampleHook.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/MinimalCounterexampleHook.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/Mode.java b/core-api/src/main/java/com/pholser/junit/quickcheck/Mode.java similarity index 73% rename from core/src/main/java/com/pholser/junit/quickcheck/Mode.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/Mode.java index bd4f12a32..d37e467ec 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/Mode.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/Mode.java @@ -25,10 +25,6 @@ a copy of this software and associated documentation files (the package com.pholser.junit.quickcheck; -import com.pholser.junit.quickcheck.internal.ParameterSampler; -import com.pholser.junit.quickcheck.internal.sampling.ExhaustiveParameterSampler; -import com.pholser.junit.quickcheck.internal.sampling.TupleParameterSampler; - /** * Represents different modes of execution of property-based tests. * @@ -40,11 +36,7 @@ public enum Mode { * Verify {@link Property#trials()} tuples of arguments for a property's * parameters. */ - SAMPLING { - @Override ParameterSampler sampler(int defaultSampleSize) { - return new TupleParameterSampler(defaultSampleSize); - } - }, + SAMPLING, /** * Generate {@link Property#trials()} arguments for each parameter @@ -52,11 +44,5 @@ public enum Mode { * This behavior mirrors that of the JUnit * {@link org.junit.experimental.theories.Theories} runner. */ - EXHAUSTIVE { - @Override ParameterSampler sampler(int defaultSampleSize) { - return new ExhaustiveParameterSampler(defaultSampleSize); - } - }; - - abstract ParameterSampler sampler(int defaultSampleSize); + EXHAUSTIVE; } diff --git a/core/src/main/java/com/pholser/junit/quickcheck/Pair.java b/core-api/src/main/java/com/pholser/junit/quickcheck/Pair.java similarity index 96% rename from core/src/main/java/com/pholser/junit/quickcheck/Pair.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/Pair.java index 770c94e30..a4796d979 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/Pair.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/Pair.java @@ -25,6 +25,8 @@ a copy of this software and associated documentation files (the package com.pholser.junit.quickcheck; +import com.pholser.junit.quickcheck.generator.Gen; + import java.util.Objects; /** @@ -32,7 +34,7 @@ a copy of this software and associated documentation files (the * * @param type of first element of pair * @param type of second element of pair - * @see com.pholser.junit.quickcheck.generator.Gen#frequency(Pair, Pair[]) + * @see Gen#frequency(Pair, Pair[]) */ public final class Pair { public final F first; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/Produced.java b/core-api/src/main/java/com/pholser/junit/quickcheck/Produced.java similarity index 95% rename from core/src/main/java/com/pholser/junit/quickcheck/Produced.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/Produced.java index 1e19ce824..525e8fb73 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/Produced.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/Produced.java @@ -31,10 +31,12 @@ a copy of this software and associated documentation files (the import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.*; +import com.pholser.junit.quickcheck.generator.Generator; + /** *

Mark a parameter of a {@link Property} method with this annotation to * have random values supplied to it via one of the - * {@link com.pholser.junit.quickcheck.generator.Generator}s specified by the + * {@link Generator}s specified by the * aggregated {@link From} annotations.

* *

Alternatively, you can specify many generators via many repetitions of diff --git a/core/src/main/java/com/pholser/junit/quickcheck/Property.java b/core-api/src/main/java/com/pholser/junit/quickcheck/Property.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/Property.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/Property.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/When.java b/core-api/src/main/java/com/pholser/junit/quickcheck/When.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/When.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/When.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/conversion/StringConversion.java b/core-api/src/main/java/com/pholser/junit/quickcheck/conversion/StringConversion.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/conversion/StringConversion.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/conversion/StringConversion.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Also.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Also.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Also.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Also.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/ComponentizedGenerator.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/ComponentizedGenerator.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/ComponentizedGenerator.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/ComponentizedGenerator.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Ctor.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Ctor.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Ctor.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Ctor.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Distinct.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Distinct.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Distinct.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Distinct.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Fields.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Fields.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Fields.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Fields.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Gen.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Gen.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Gen.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Gen.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/GenerationStatus.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/GenerationStatus.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/GenerationStatus.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/GenerationStatus.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java similarity index 99% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java index 99b31d43d..0a6c9d9a9 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Generator.java @@ -36,6 +36,8 @@ a copy of this software and associated documentation files (the import java.util.Map; import java.util.function.Consumer; +import com.pholser.junit.quickcheck.GeneratorConfigurationException; +import com.pholser.junit.quickcheck.internal.Reflection; import com.pholser.junit.quickcheck.internal.ReflectionException; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import org.javaruntype.type.TypeParameter; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfiguration.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfiguration.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfiguration.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/GeneratorConfiguration.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Generators.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Generators.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Generators.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Generators.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullAllowed.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/NullAllowed.java similarity index 92% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullAllowed.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/NullAllowed.java index 86034fc70..69c0fbf0b 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullAllowed.java +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/NullAllowed.java @@ -1,4 +1,4 @@ -package com.pholser.junit.quickcheck.internal.generator; +package com.pholser.junit.quickcheck.generator; import java.lang.annotation.Retention; import java.lang.annotation.Target; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Only.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Only.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Only.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Only.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Shrink.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Shrink.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Shrink.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Shrink.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Size.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/Size.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/Size.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/Size.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/ValuesOf.java b/core-api/src/main/java/com/pholser/junit/quickcheck/generator/ValuesOf.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/generator/ValuesOf.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/generator/ValuesOf.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/hook/NilMinimalCounterexampleHook.java b/core-api/src/main/java/com/pholser/junit/quickcheck/hook/NilMinimalCounterexampleHook.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/hook/NilMinimalCounterexampleHook.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/hook/NilMinimalCounterexampleHook.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/Comparables.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/Comparables.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/Comparables.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/Comparables.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/Items.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/Items.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/Items.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/Items.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/Reflection.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/Reflection.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/Reflection.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/Reflection.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/ReflectionException.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/ReflectionException.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/ReflectionException.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/ReflectionException.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/Weighted.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/Weighted.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/Weighted.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/Weighted.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/Zilch.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/Zilch.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/Zilch.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/Zilch.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ZilchGenerator.java b/core-api/src/main/java/com/pholser/junit/quickcheck/internal/generator/ZilchGenerator.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ZilchGenerator.java rename to core-api/src/main/java/com/pholser/junit/quickcheck/internal/generator/ZilchGenerator.java diff --git a/core-api/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java b/core-api/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java new file mode 100644 index 000000000..2b497c8af --- /dev/null +++ b/core-api/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java @@ -0,0 +1,215 @@ +package com.pholser.junit.quickcheck.random; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.Collection; +import java.util.Random; + +public interface SourceOfRandomness { + /** + *

Gives a JDK source of randomness, with the same internal state as + * this source of randomness.

+ * + * @return a JDK "clone" of self + */ + Random toJDKRandom(); + + /** + * @return a uniformly distributed boolean value + * @see Random#nextBoolean() + */ + boolean nextBoolean(); + + /** + * @param bytes a byte array to fill with random values + * @see Random#nextBytes(byte[]) + */ + void nextBytes(byte[] bytes); + + /** + * Gives an array of a given length containing random bytes. + * + * @param count the desired length of the random byte array + * @return random bytes + * @see Random#nextBytes(byte[]) + */ + byte[] nextBytes(int count); + + /** + * @return a uniformly distributed random {@code double} value in the + * interval {@code [0.0, 1.0)} + * @see Random#nextDouble() + */ + double nextDouble(); + + /** + * @return a uniformly distributed random {@code float} value in the + * interval {@code [0.0, 1.0)} + * @see Random#nextFloat() + */ + float nextFloat(); + + /** + * @return a Gaussian-distributed random double value + * @see Random#nextGaussian() + */ + double nextGaussian(); + + /** + * @return a uniformly distributed random {@code int} value + * @see Random#nextInt() + */ + int nextInt(); + + /** + * @param n upper bound + * @return a uniformly distributed random {@code int} value in the interval + * {@code [0, n)} + * @see Random#nextInt(int) + */ + int nextInt(int n); + + /** + * @return a uniformly distributed random {@code long} value + * @see Random#nextLong() + */ + long nextLong(); + + /** + * @param seed value with which to seed this source of randomness + * @see Random#setSeed(long) + */ + void setSeed(long seed); + + /** + * @return the value used to initially seed this source of randomness + */ + long seed(); + + /** + * Gives a random {@code byte} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + byte nextByte(byte min, byte max); + + /** + * Gives a random {@code char} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + char nextChar(char min, char max); + + /** + *

Gives a random {@code double} value in the interval + * {@code [min, max)}.

+ * + *

This naive implementation takes a random {@code double} value from + * {@link Random#nextDouble()} and scales/shifts the value into the desired + * interval. This may give surprising results for large ranges.

+ * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + double nextDouble(double min, double max); + + /** + *

Gives a random {@code float} value in the interval + * {@code [min, max)}.

+ * + *

This naive implementation takes a random {@code float} value from + * {@link Random#nextFloat()} and scales/shifts the value into the desired + * interval. This may give surprising results for large ranges.

+ * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + float nextFloat(float min, float max); + + /** + * Gives a random {@code int} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + int nextInt(int min, int max); + + /** + * Gives a random {@code long} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + long nextLong(long min, long max); + + /** + * Gives a random {@code short} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + short nextShort(short min, short max); + + /** + * Gives a random {@code BigInteger} representable by the given number + * of bits. + * + * @param numberOfBits the desired number of bits + * @return a random {@code BigInteger} + * @see BigInteger#BigInteger(int, Random) + */ + BigInteger nextBigInteger(int numberOfBits); + + /** + * Gives a random {@code Instant} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + Instant nextInstant(Instant min, Instant max); + + /** + * Gives a random {@code Duration} value, uniformly distributed across the + * interval {@code [min, max]}. + * + * @param min lower bound of the desired interval + * @param max upper bound of the desired interval + * @return a random value + */ + Duration nextDuration(Duration min, Duration max); + + /** + * Gives a random element of the given collection. + * + * @param type of items in the collection + * @param items a collection + * @return a randomly chosen element from the collection + */ + T choose(Collection items); + + /** + * Gives a random element of the given array. + * + * @param type of items in the array + * @param items an array + * @return a randomly chosen element from the array + */ + T choose(T[] items); +} diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Annotations.java b/core-api/src/test/java/com/pholser/junit/quickcheck/Annotations.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Annotations.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/Annotations.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesTest.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesTest.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/InvocationTargetProblematic.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/InvocationTargetProblematic.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/InvocationTargetProblematic.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/InvocationTargetProblematic.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ItemsTest.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/ItemsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ItemsTest.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/ItemsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/MultiArgIllegalAccessProblematic.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/MultiArgIllegalAccessProblematic.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/MultiArgIllegalAccessProblematic.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/MultiArgIllegalAccessProblematic.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionTest.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionTest.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ZeroArgIllegalAccessProblematic.java b/core-api/src/test/java/com/pholser/junit/quickcheck/internal/ZeroArgIllegalAccessProblematic.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ZeroArgIllegalAccessProblematic.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/internal/ZeroArgIllegalAccessProblematic.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABigInt.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABigInt.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABigInt.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABigInt.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABool.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABool.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABool.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABool.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABox.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABox.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ABox.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ABox.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AByte.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AByte.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AByte.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AByte.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ACallable.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ACallable.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ACallable.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ACallable.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AChar.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AChar.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AChar.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AChar.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ADecimal.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ADecimal.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ADecimal.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ADecimal.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ADouble.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ADouble.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ADouble.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ADouble.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFloat.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFloat.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFloat.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFloat.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFoo.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFoo.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFoo.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFoo.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFooBadShrinks.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFooBadShrinks.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AFooBadShrinks.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AFooBadShrinks.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AList.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AList.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AList.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AList.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/ALong.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ALong.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/ALong.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/ALong.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AMap.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AMap.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AMap.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AMap.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/APair.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/APair.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/APair.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/APair.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AShort.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AShort.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AShort.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AShort.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AString.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AString.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AString.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AString.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AnInt.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AnInt.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AnInt.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AnInt.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/AnotherBox.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AnotherBox.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/AnotherBox.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/AnotherBox.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/Between.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Between.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/Between.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Between.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java similarity index 95% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java index 32c2bd112..99cd4c367 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java +++ b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Box.java @@ -25,7 +25,7 @@ a copy of this software and associated documentation files (the package com.pholser.junit.quickcheck.test.generator; -import com.google.common.base.Objects; +import java.util.Objects; public class Box { private final T contents; @@ -59,7 +59,7 @@ public boolean marked() { return false; Box other = (Box) o; - return Objects.equal(contents, other.contents); + return Objects.equals(contents, other.contents); } @Override public String toString() { diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/Foo.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Foo.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/Foo.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Foo.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/FooBoxOpener.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/FooBoxOpener.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/FooBoxOpener.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/FooBoxOpener.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/Pair.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Pair.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/Pair.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/Pair.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/TestGeneratorSource.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/TestGeneratorSource.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/TestGeneratorSource.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/TestGeneratorSource.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/test/generator/X.java b/core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/X.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/test/generator/X.java rename to core-api/src/test/java/com/pholser/junit/quickcheck/test/generator/X.java diff --git a/core/pom.xml b/core/pom.xml index c22b6300f..1f5662038 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -16,17 +16,13 @@ - junit - junit - - - org.hamcrest - hamcrest-core + com.pholser + junit-quickcheck-core-api + org.javaruntype javaruntype - 1.3 ognl @@ -43,6 +39,16 @@ slf4j-api + + junit + junit + test + + + org.hamcrest + hamcrest-core + test + org.hamcrest hamcrest-library diff --git a/core/src/main/java/com/pholser/junit/quickcheck/generator/Lambdas.java b/core/src/main/java/com/pholser/junit/quickcheck/generator/Lambdas.java index 0021370b3..c2ceaca8c 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/generator/Lambdas.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/generator/Lambdas.java @@ -34,6 +34,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.internal.GeometricDistribution; import com.pholser.junit.quickcheck.internal.generator.SimpleGenerationStatus; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import static java.lang.System.*; @@ -123,7 +124,7 @@ private static class LambdaInvocationHandler implements InvocationHandler if (method.isDefault()) return handleDefaultMethod(proxy, method, args); - SourceOfRandomness source = new SourceOfRandomness(new Random()); + SourceOfRandomness source = new DefaultSourceOfRandomness(new Random()); source.setSeed(Arrays.hashCode(args)); GenerationStatus status = new SimpleGenerationStatus(new GeometricDistribution(), source, attempts); diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ArrayGenerator.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ArrayGenerator.java index ee5c47b0e..c4fee4353 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ArrayGenerator.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ArrayGenerator.java @@ -35,6 +35,8 @@ a copy of this software and associated documentation files (the import java.util.stream.IntStream; import java.util.stream.Stream; +import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.generator.Shrink; import com.pholser.junit.quickcheck.generator.*; import com.pholser.junit.quickcheck.internal.Lists; import com.pholser.junit.quickcheck.random.SourceOfRandomness; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/CompositeGenerator.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/CompositeGenerator.java index 9a66e6f93..3498c80f7 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/CompositeGenerator.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/CompositeGenerator.java @@ -34,7 +34,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; -import com.pholser.junit.quickcheck.generator.GeneratorConfigurationException; +import com.pholser.junit.quickcheck.GeneratorConfigurationException; import com.pholser.junit.quickcheck.generator.Generators; import com.pholser.junit.quickcheck.internal.Items; import com.pholser.junit.quickcheck.internal.Weighted; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/GeneratorRepository.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/GeneratorRepository.java index 855b947c2..f578aaa48 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/GeneratorRepository.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/GeneratorRepository.java @@ -47,6 +47,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.Fields; import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.generator.Generators; +import com.pholser.junit.quickcheck.generator.NullAllowed; import com.pholser.junit.quickcheck.internal.ParameterTypeContext; import com.pholser.junit.quickcheck.internal.Weighted; import com.pholser.junit.quickcheck.internal.Zilch; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullableGenerator.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullableGenerator.java index 8cdc5479f..3d21f3f30 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullableGenerator.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/NullableGenerator.java @@ -27,6 +27,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.generator.Generators; +import com.pholser.junit.quickcheck.generator.NullAllowed; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import org.javaruntype.type.TypeParameter; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ServiceLoaderGeneratorSource.java b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ServiceLoaderGeneratorSource.java index 56730b146..3d6e71ece 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ServiceLoaderGeneratorSource.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/internal/generator/ServiceLoaderGeneratorSource.java @@ -27,7 +27,6 @@ a copy of this software and associated documentation files (the import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; diff --git a/core/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java b/core/src/main/java/com/pholser/junit/quickcheck/random/DefaultSourceOfRandomness.java similarity index 55% rename from core/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java rename to core/src/main/java/com/pholser/junit/quickcheck/random/DefaultSourceOfRandomness.java index 83df05e33..98d15474b 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/random/SourceOfRandomness.java +++ b/core/src/main/java/com/pholser/junit/quickcheck/random/DefaultSourceOfRandomness.java @@ -36,6 +36,7 @@ a copy of this software and associated documentation files (the import java.util.Collection; import java.util.Random; +import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.internal.Items; import com.pholser.junit.quickcheck.internal.Ranges; @@ -45,10 +46,10 @@ a copy of this software and associated documentation files (the /** * A source of randomness, fed to - * {@linkplain com.pholser.junit.quickcheck.generator.Generator generators} + * {@linkplain Generator generators} * so they can produce random values for property parameters. */ -public class SourceOfRandomness { +public class DefaultSourceOfRandomness implements SourceOfRandomness { private static final BigInteger NANOS_PER_SECOND = BigInteger.valueOf(SECONDS.toNanos(1)); @@ -62,18 +63,13 @@ public class SourceOfRandomness { * @param delegate a JDK source of randomness, to which the new instance * will delegate */ - public SourceOfRandomness(Random delegate) { + public DefaultSourceOfRandomness(Random delegate) { seed = delegate.nextLong(); this.delegate = delegate; delegate.setSeed(seed); } - /** - *

Gives a JDK source of randomness, with the same internal state as - * this source of randomness.

- * - * @return a JDK "clone" of self - */ + @Override public Random toJDKRandom() { ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); @@ -93,183 +89,94 @@ public Random toJDKRandom() { } } - /** - * @return a uniformly distributed boolean value - * @see java.util.Random#nextBoolean() - */ + @Override public boolean nextBoolean() { return delegate.nextBoolean(); } - /** - * @param bytes a byte array to fill with random values - * @see java.util.Random#nextBytes(byte[]) - */ + @Override public void nextBytes(byte[] bytes) { delegate.nextBytes(bytes); } - /** - * Gives an array of a given length containing random bytes. - * - * @param count the desired length of the random byte array - * @return random bytes - * @see java.util.Random#nextBytes(byte[]) - */ + @Override public byte[] nextBytes(int count) { byte[] buffer = new byte[count]; delegate.nextBytes(buffer); return buffer; } - /** - * @return a uniformly distributed random {@code double} value in the - * interval {@code [0.0, 1.0)} - * @see java.util.Random#nextDouble() - */ + @Override public double nextDouble() { return delegate.nextDouble(); } - /** - * @return a uniformly distributed random {@code float} value in the - * interval {@code [0.0, 1.0)} - * @see java.util.Random#nextFloat() - */ + @Override public float nextFloat() { return delegate.nextFloat(); } - /** - * @return a Gaussian-distributed random double value - * @see java.util.Random#nextGaussian() - */ + @Override public double nextGaussian() { return delegate.nextGaussian(); } - /** - * @return a uniformly distributed random {@code int} value - * @see java.util.Random#nextInt() - */ + @Override public int nextInt() { return delegate.nextInt(); } - /** - * @param n upper bound - * @return a uniformly distributed random {@code int} value in the interval - * {@code [0, n)} - * @see java.util.Random#nextInt(int) - */ + @Override public int nextInt(int n) { return delegate.nextInt(n); } - /** - * @return a uniformly distributed random {@code long} value - * @see java.util.Random#nextLong() - */ + @Override public long nextLong() { return delegate.nextLong(); } - /** - * @param seed value with which to seed this source of randomness - * @see java.util.Random#setSeed(long) - */ + @Override public void setSeed(long seed) { this.seed = seed; delegate.setSeed(seed); } - /** - * @return the value used to initially seed this source of randomness - */ + @Override public long seed() { return seed; } - /** - * Gives a random {@code byte} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public byte nextByte(byte min, byte max) { return (byte) nextLong(min, max); } - /** - * Gives a random {@code char} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public char nextChar(char min, char max) { checkRange(Ranges.Type.CHARACTER, min, max); return (char) nextLong(min, max); } - /** - *

Gives a random {@code double} value in the interval - * {@code [min, max)}.

- * - *

This naive implementation takes a random {@code double} value from - * {@link Random#nextDouble()} and scales/shifts the value into the desired - * interval. This may give surprising results for large ranges.

- * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public double nextDouble(double min, double max) { int comparison = checkRange(Ranges.Type.FLOAT, min, max); return comparison == 0 ? min : min + (max - min) * nextDouble(); } - /** - *

Gives a random {@code float} value in the interval - * {@code [min, max)}.

- * - *

This naive implementation takes a random {@code float} value from - * {@link Random#nextFloat()} and scales/shifts the value into the desired - * interval. This may give surprising results for large ranges.

- * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public float nextFloat(float min, float max) { int comparison = checkRange(Ranges.Type.FLOAT, min, max); return comparison == 0 ? min : min + (max - min) * nextFloat(); } - /** - * Gives a random {@code int} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public int nextInt(int min, int max) { return (int) nextLong(min, max); } - /** - * Gives a random {@code long} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public long nextLong(long min, long max) { int comparison = checkRange(Ranges.Type.INTEGRAL, min, max); if (comparison == 0) @@ -278,38 +185,17 @@ public long nextLong(long min, long max) { return Ranges.choose(this, min, max); } - /** - * Gives a random {@code short} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public short nextShort(short min, short max) { return (short) nextLong(min, max); } - /** - * Gives a random {@code BigInteger} representable by the given number - * of bits. - * - * @param numberOfBits the desired number of bits - * @return a random {@code BigInteger} - * @see BigInteger#BigInteger(int, java.util.Random) - */ + @Override public BigInteger nextBigInteger(int numberOfBits) { return new BigInteger(numberOfBits, delegate); } - /** - * Gives a random {@code Instant} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public Instant nextInstant(Instant min, Instant max) { int comparison = checkRange(Ranges.Type.STRING, min, max); if (comparison == 0) @@ -324,14 +210,7 @@ public Instant nextInstant(Instant min, Instant max) { return Instant.ofEpochSecond(next[0], next[1]); } - /** - * Gives a random {@code Duration} value, uniformly distributed across the - * interval {@code [min, max]}. - * - * @param min lower bound of the desired interval - * @param max upper bound of the desired interval - * @return a random value - */ + @Override public Duration nextDuration(Duration min, Duration max) { int comparison = checkRange(Ranges.Type.STRING, min, max); if (comparison == 0) @@ -346,24 +225,12 @@ public Duration nextDuration(Duration min, Duration max) { return Duration.ofSeconds(next[0], next[1]); } - /** - * Gives a random element of the given collection. - * - * @param type of items in the collection - * @param items a collection - * @return a randomly chosen element from the collection - */ + @Override public T choose(Collection items) { return Items.choose(items, this); } - /** - * Gives a random element of the given array. - * - * @param type of items in the array - * @param items an array - * @return a randomly chosen element from the array - */ + @Override public T choose(T[] items) { return items[nextInt(items.length)]; } diff --git a/examples/pom.xml b/examples/pom.xml index c8e1e4019..50fe54cec 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -16,21 +16,20 @@ http://github.com/pholser/junit-quickcheck - - junit - junit - com.pholser - junit-quickcheck-core - 0.10-SNAPSHOT + junit-quickcheck-junit4 com.pholser junit-quickcheck-generators - 0.10-SNAPSHOT + + junit + junit + test + com.google.guava guava @@ -54,8 +53,7 @@ com.pholser - junit-quickcheck-core - 0.10-SNAPSHOT + junit-quickcheck-junit4 test test-jar diff --git a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PointGenerator.java b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PointGenerator.java index 94a90ab28..ba2dce7ba 100644 --- a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PointGenerator.java +++ b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PointGenerator.java @@ -27,7 +27,6 @@ a copy of this software and associated documentation files (the import java.util.List; -import com.pholser.junit.quickcheck.examples.geom.Point; import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.random.SourceOfRandomness; diff --git a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PolygonGenerator.java b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PolygonGenerator.java index 1fa9d67b5..abd1fdffd 100644 --- a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PolygonGenerator.java +++ b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/PolygonGenerator.java @@ -27,8 +27,6 @@ a copy of this software and associated documentation files (the import java.util.List; -import com.pholser.junit.quickcheck.examples.geom.Point; -import com.pholser.junit.quickcheck.examples.geom.Polygon; import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.generator.Size; diff --git a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/SegmentGenerator.java b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/SegmentGenerator.java index 4090698e8..b0eb7edcd 100644 --- a/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/SegmentGenerator.java +++ b/examples/src/test/java/com/pholser/junit/quickcheck/examples/geom/SegmentGenerator.java @@ -27,8 +27,6 @@ a copy of this software and associated documentation files (the import java.util.List; -import com.pholser.junit.quickcheck.examples.geom.Point; -import com.pholser.junit.quickcheck.examples.geom.Segment; import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.random.SourceOfRandomness; diff --git a/examples/src/test/java/com/pholser/junit/quickcheck/examples/nullable/NullableParameterTest.java b/examples/src/test/java/com/pholser/junit/quickcheck/examples/nullable/NullableParameterTest.java index 8058a2259..3d22c5d42 100644 --- a/examples/src/test/java/com/pholser/junit/quickcheck/examples/nullable/NullableParameterTest.java +++ b/examples/src/test/java/com/pholser/junit/quickcheck/examples/nullable/NullableParameterTest.java @@ -28,7 +28,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.Property; import com.pholser.junit.quickcheck.examples.number.NonNegative; import com.pholser.junit.quickcheck.generator.java.lang.IntegerGenerator; -import com.pholser.junit.quickcheck.internal.generator.NullAllowed; +import com.pholser.junit.quickcheck.generator.NullAllowed; import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; import org.junit.runner.RunWith; diff --git a/generators/pom.xml b/generators/pom.xml index 4a92a61ae..f31ec38db 100644 --- a/generators/pom.xml +++ b/generators/pom.xml @@ -16,16 +16,16 @@ http://github.com/pholser/junit-quickcheck - - junit - junit - com.pholser - junit-quickcheck-core - 0.10-SNAPSHOT + junit-quickcheck-junit4 + + junit + junit + test + org.hamcrest hamcrest-core @@ -58,8 +58,7 @@ com.pholser - junit-quickcheck-core - 0.10-SNAPSHOT + junit-quickcheck-junit4 test test-jar diff --git a/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/CollectionGenerator.java b/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/CollectionGenerator.java index 37e35bb17..bd24fe4d8 100644 --- a/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/CollectionGenerator.java +++ b/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/CollectionGenerator.java @@ -31,6 +31,8 @@ a copy of this software and associated documentation files (the import java.util.List; import java.util.stream.Stream; +import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.generator.Shrink; import com.pholser.junit.quickcheck.generator.*; import com.pholser.junit.quickcheck.internal.Lists; import com.pholser.junit.quickcheck.random.SourceOfRandomness; diff --git a/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/MapGenerator.java b/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/MapGenerator.java index d575a5223..43dc420e4 100644 --- a/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/MapGenerator.java +++ b/generators/src/main/java/com/pholser/junit/quickcheck/generator/java/util/MapGenerator.java @@ -34,6 +34,8 @@ a copy of this software and associated documentation files (the import java.util.Map.Entry; import java.util.stream.Stream; +import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.generator.Shrink; import com.pholser.junit.quickcheck.generator.*; import com.pholser.junit.quickcheck.internal.Lists; import com.pholser.junit.quickcheck.random.SourceOfRandomness; diff --git a/generators/src/test/java/com/pholser/junit/quickcheck/PrimitivePropertyParameterTypesTest.java b/generators/src/test/java/com/pholser/junit/quickcheck/PrimitivePropertyParameterTypesTest.java index 6964c274e..ab5b6e479 100644 --- a/generators/src/test/java/com/pholser/junit/quickcheck/PrimitivePropertyParameterTypesTest.java +++ b/generators/src/test/java/com/pholser/junit/quickcheck/PrimitivePropertyParameterTypesTest.java @@ -29,7 +29,6 @@ a copy of this software and associated documentation files (the import java.util.List; import com.google.common.collect.Iterables; -import com.pholser.junit.quickcheck.generator.GeneratorConfigurationException; import com.pholser.junit.quickcheck.generator.InRange; import com.pholser.junit.quickcheck.generator.RangeAttributes; import com.pholser.junit.quickcheck.generator.ValuesOf; diff --git a/guava/pom.xml b/guava/pom.xml index f3679b8dd..f9a714c67 100644 --- a/guava/pom.xml +++ b/guava/pom.xml @@ -15,19 +15,13 @@ http://github.com/pholser/junit-quickcheck - - junit - junit - com.pholser junit-quickcheck-core - 0.10-SNAPSHOT com.pholser junit-quickcheck-generators - 0.10-SNAPSHOT com.google.guava @@ -35,6 +29,11 @@ compile + + junit + junit + test + org.hamcrest hamcrest-core @@ -57,8 +56,13 @@ com.pholser - junit-quickcheck-core - 0.10-SNAPSHOT + junit-quickcheck-core-api + test + test-jar + + + com.pholser + junit-quickcheck-junit4 test test-jar diff --git a/guava/src/test/java/com/pholser/junit/quickcheck/guava/generator/FunctionOfStringToIntPropertyParameterTest.java b/guava/src/test/java/com/pholser/junit/quickcheck/guava/generator/FunctionOfStringToIntPropertyParameterTest.java index 236d3559d..31c751963 100644 --- a/guava/src/test/java/com/pholser/junit/quickcheck/guava/generator/FunctionOfStringToIntPropertyParameterTest.java +++ b/guava/src/test/java/com/pholser/junit/quickcheck/guava/generator/FunctionOfStringToIntPropertyParameterTest.java @@ -33,6 +33,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.Generator; import com.pholser.junit.quickcheck.internal.generator.CorePropertyParameterTest; import com.pholser.junit.quickcheck.internal.generator.ServiceLoaderGeneratorSource; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import static com.google.common.collect.Lists.*; @@ -70,7 +71,7 @@ public class FunctionOfStringToIntPropertyParameterTest extends CorePropertyPara String argument = "foobar"; - SourceOfRandomness source = new SourceOfRandomness(new Random()); + SourceOfRandomness source = new DefaultSourceOfRandomness(new Random()); source.setSeed(Objects.hashCode(argument)); Integer value = (Integer) repository.generatorFor(typeOf(getClass(), "integer")).generate(source, null); diff --git a/pom.xml b/pom.xml index 65c3f33ba..7f1eb7725 100644 --- a/pom.xml +++ b/pom.xml @@ -104,7 +104,9 @@ + core-api core + runner-junit4 generators guava examples @@ -113,19 +115,43 @@ - junit - junit - 4.12 + com.pholser + junit-quickcheck-core-api + ${project.version} - - org.hamcrest - hamcrest-core - 1.3 + com.pholser + junit-quickcheck-core + ${project.version} - org.hamcrest - hamcrest-library + com.pholser + junit-quickcheck-junit4 + ${project.version} + + + com.pholser + junit-quickcheck-generators + ${project.version} + + + com.pholser + junit-quickcheck-core-api + ${project.version} + test-jar + test + + + com.pholser + junit-quickcheck-junit4 + ${project.version} + test-jar + test + + + + org.javaruntype + javaruntype 1.3 @@ -133,25 +159,47 @@ slf4j-api 1.7.25 - - org.mockito - mockito-all - 1.10.19 - com.google.guava guava 23.0 + - com.google.guava - guava-testlib - 23.0 + junit + junit + 4.12 + test ch.qos.logback logback-classic 1.2.3 + test + + + com.google.guava + guava-testlib + 23.0 + test + + + org.hamcrest + hamcrest-core + 1.3 + test + + + org.hamcrest + hamcrest-library + 1.3 + test + + + org.mockito + mockito-all + 1.10.19 + test @@ -286,14 +334,14 @@ Low true - - - verify - - check - - - + + + + + + + + org.apache.maven.plugins diff --git a/runner-junit4/pom.xml b/runner-junit4/pom.xml new file mode 100644 index 000000000..f13449ab4 --- /dev/null +++ b/runner-junit4/pom.xml @@ -0,0 +1,119 @@ + + 4.0.0 + + + com.pholser + junit-quickcheck + 0.10-SNAPSHOT + + + junit-quickcheck-junit4 + 0.10-SNAPSHOT + jar + junit-quickcheck-junit4 + Property-based testing, JUnit-style: core functionality + http://github.com/pholser/junit-quickcheck + + + + com.pholser + junit-quickcheck-core-api + + + com.pholser + junit-quickcheck-core + + + + junit + junit + compile + + + + org.hamcrest + hamcrest-core + compile + + + + org.javaruntype + javaruntype + + + ognl + ognl + 3.1.12 + + + ru.vyarus + generics-resolver + 2.0.1 + + + org.slf4j + slf4j-api + + + + com.pholser + junit-quickcheck-core-api + test-jar + + + + org.hamcrest + hamcrest-library + test + + + org.mockito + mockito-all + test + + + com.google.guava + guava + test + + + com.google.guava + guava-testlib + test + + + ch.qos.logback + logback-classic + test + + + + + + + org.apache.maven.plugins + maven-release-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.jacoco + jacoco-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + org.apache.maven.plugins + maven-pmd-plugin + + + org.codehaus.mojo + findbugs-maven-plugin + + + + diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java similarity index 96% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java index 4c6d5bd70..9b474d2ea 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java +++ b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/JUnitQuickcheck.java @@ -33,6 +33,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.internal.GeometricDistribution; import com.pholser.junit.quickcheck.internal.generator.GeneratorRepository; import com.pholser.junit.quickcheck.internal.generator.ServiceLoaderGeneratorSource; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import org.junit.Test; import org.junit.runners.BlockJUnit4ClassRunner; @@ -72,7 +73,7 @@ public class JUnitQuickcheck extends BlockJUnit4ClassRunner { public JUnitQuickcheck(Class clazz) throws InitializationError { super(clazz); - SourceOfRandomness random = new SourceOfRandomness(new Random()); + SourceOfRandomness random = new DefaultSourceOfRandomness(new Random()); repo = new GeneratorRepository(random).register(new ServiceLoaderGeneratorSource()); distro = new GeometricDistribution(); logger = LoggerFactory.getLogger("junit-quickcheck.value-reporting"); diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/NoValuesSatisfiedPropertyAssumptions.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/NoValuesSatisfiedPropertyAssumptions.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/NoValuesSatisfiedPropertyAssumptions.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/NoValuesSatisfiedPropertyAssumptions.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyFalsified.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyFalsified.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyFalsified.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyFalsified.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java similarity index 98% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java index f5e82df7d..7460d169b 100644 --- a/core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java +++ b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyStatement.java @@ -44,6 +44,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.internal.ShrinkControl; import com.pholser.junit.quickcheck.internal.generator.GeneratorRepository; import com.pholser.junit.quickcheck.internal.generator.PropertyParameterGenerationContext; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.internal.sampling.ExhaustiveParameterSampler; import com.pholser.junit.quickcheck.internal.sampling.TupleParameterSampler; @@ -101,7 +102,7 @@ class PropertyStatement extends Statement { p, repo, distro, - new SourceOfRandomness(new Random()), + new DefaultSourceOfRandomness(new Random()), sampler )) .collect(toList()); diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyVerifier.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyVerifier.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/PropertyVerifier.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/PropertyVerifier.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/ShrinkNode.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/ShrinkNode.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/ShrinkNode.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/ShrinkNode.java diff --git a/core/src/main/java/com/pholser/junit/quickcheck/runner/Shrinker.java b/runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/Shrinker.java similarity index 100% rename from core/src/main/java/com/pholser/junit/quickcheck/runner/Shrinker.java rename to runner-junit4/src/main/java/com/pholser/junit/quickcheck/runner/Shrinker.java diff --git a/core/src/main/java/org/junit/runners/model/JUnitQuickcheckTestClass.java b/runner-junit4/src/main/java/org/junit/runners/model/JUnitQuickcheckTestClass.java similarity index 100% rename from core/src/main/java/org/junit/runners/model/JUnitQuickcheckTestClass.java rename to runner-junit4/src/main/java/org/junit/runners/model/JUnitQuickcheckTestClass.java diff --git a/core/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator b/runner-junit4/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator similarity index 100% rename from core/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator rename to runner-junit4/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator diff --git a/core/src/test/java/com/pholser/junit/quickcheck/BasicCapabilitiesOfGeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/BasicCapabilitiesOfGeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/BasicCapabilitiesOfGeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/BasicCapabilitiesOfGeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Classes.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Classes.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Classes.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Classes.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ComponentizedGeneratorsIsolateConfigurationFromComponentsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ComponentizedGeneratorsIsolateConfigurationFromComponentsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/ComponentizedGeneratorsIsolateConfigurationFromComponentsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ComponentizedGeneratorsIsolateConfigurationFromComponentsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java similarity index 99% rename from core/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java index 9f3549b0c..b80be9bd0 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ComposedObjectsTest.java @@ -27,7 +27,6 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; -import com.pholser.junit.quickcheck.internal.ParameterTypeContext; import com.pholser.junit.quickcheck.internal.ReflectionException; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; diff --git a/core/src/test/java/com/pholser/junit/quickcheck/EnumPropertyParameterTypesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/EnumPropertyParameterTypesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/EnumPropertyParameterTypesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/EnumPropertyParameterTypesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/EqualsHashCodePropertiesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/EqualsHashCodePropertiesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/EqualsHashCodePropertiesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/EqualsHashCodePropertiesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetButIncludingAnotherTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetButIncludingAnotherTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetButIncludingAnotherTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetButIncludingAnotherTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ExhaustingAGivenSetTest.java diff --git a/runner-junit4/src/test/java/com/pholser/junit/quickcheck/FieldMetaAnnotationTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/FieldMetaAnnotationTest.java new file mode 100644 index 000000000..a9bb8ab04 --- /dev/null +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/FieldMetaAnnotationTest.java @@ -0,0 +1,64 @@ +package com.pholser.junit.quickcheck; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import com.pholser.junit.quickcheck.generator.GenerationStatus; +import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.generator.GeneratorConfiguration; +import com.pholser.junit.quickcheck.random.SourceOfRandomness; +import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; +import org.junit.runner.RunWith; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@RunWith(JUnitQuickcheck.class) +public class FieldMetaAnnotationTest { + @From(StringGen.class) // <-- if you remove this the test passes + @From(StringGen.class) @Regex("hello") String stringGen; + + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.RUNTIME) + @GeneratorConfiguration + @interface Regex { + String value(); + } + + public static class StringGen extends Generator { + private Regex regex; + + public StringGen() { + super(String.class); + } + + public void configure(Regex regex) { + this.regex = regex; + } + + @Override + public String generate(SourceOfRandomness random, GenerationStatus status) { + assert regex != null: "regex was not set"; + return regex.value(); + } + } + + public static class ExtraGen extends Generator { + public ExtraGen() { + super(String.class); + } + + @Override + public String generate(SourceOfRandomness random, GenerationStatus status) { + Generator stringGen = (Generator) gen().field(FieldMetaAnnotationTest.class, "stringGen"); + return stringGen.generate(random, status); + } + } + + + @Property public void helloworld(@From(ExtraGen.class) String value) { + assertThat(value, is("hello")); + } +} diff --git a/core/src/test/java/com/pholser/junit/quickcheck/FilterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/FilterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/FilterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/FilterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/FooEqualsHashCodeTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/FooEqualsHashCodeTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/FooEqualsHashCodeTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/FooEqualsHashCodeTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Functions.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Functions.java similarity index 91% rename from core/src/test/java/com/pholser/junit/quickcheck/Functions.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Functions.java index ebfeff633..f1908646d 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/Functions.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Functions.java @@ -29,6 +29,7 @@ a copy of this software and associated documentation files (the import java.util.Random; import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; public final class Functions { @@ -37,7 +38,7 @@ private Functions() { } public static T functionValue(Generator generator, Object[] args) { - SourceOfRandomness source = new SourceOfRandomness(new Random()); + SourceOfRandomness source = new DefaultSourceOfRandomness(new Random()); source.setSeed(Arrays.hashCode(args)); return generator.generate(source, null); } diff --git a/core/src/test/java/com/pholser/junit/quickcheck/GeneratorDescriptorsIssue235.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/GeneratorDescriptorsIssue235.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/GeneratorDescriptorsIssue235.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/GeneratorDescriptorsIssue235.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/GeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/GeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/GeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/GeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/GenericArrayPropertyParameterTypesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/GenericArrayPropertyParameterTypesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/GenericArrayPropertyParameterTypesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/GenericArrayPropertyParameterTypesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/LambdaPropertyParameterTypesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/LambdaPropertyParameterTypesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/LambdaPropertyParameterTypesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/LambdaPropertyParameterTypesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Lists.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Lists.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Lists.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Lists.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/LongRunning.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/LongRunning.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/LongRunning.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/LongRunning.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/MapFlatMapTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/MapFlatMapTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/MapFlatMapTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/MapFlatMapTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/MarkingTypeUsesOnPropertyParametersWithConfigurationTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/MarkingTypeUsesOnPropertyParametersWithConfigurationTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/MarkingTypeUsesOnPropertyParametersWithConfigurationTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/MarkingTypeUsesOnPropertyParametersWithConfigurationTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/MinimalCounterexampleHookTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/MinimalCounterexampleHookTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/MinimalCounterexampleHookTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/MinimalCounterexampleHookTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Objects.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Objects.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Objects.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Objects.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PairTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PairTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PairTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PairTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertiesWithExplicitGeneratorsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertiesWithExplicitGeneratorsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertiesWithExplicitGeneratorsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertiesWithExplicitGeneratorsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyExhaustiveSampleSizeTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyExhaustiveSampleSizeTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyExhaustiveSampleSizeTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyExhaustiveSampleSizeTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterConfigurationIsolationTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterConfigurationIsolationTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterConfigurationIsolationTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterConfigurationIsolationTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterDiscardRatioTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterDiscardRatioTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterDiscardRatioTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterDiscardRatioTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByConstructorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByConstructorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByConstructorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByConstructorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByFieldsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByFieldsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByFieldsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterGenerationByFieldsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java similarity index 98% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java index 65089e113..5bec0de4f 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyParameterMarkedWithSuperfluousConfigurationTest.java @@ -29,7 +29,6 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; -import com.pholser.junit.quickcheck.generator.GeneratorConfigurationException; import com.pholser.junit.quickcheck.generator.ValuesOf; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; diff --git a/core/src/test/java/com/pholser/junit/quickcheck/PropertyTupleSampleSizeTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyTupleSampleSizeTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/PropertyTupleSampleSizeTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/PropertyTupleSampleSizeTest.java diff --git a/generators/src/test/java/com/pholser/junit/quickcheck/ReferenceArrayPropertyParameterTypesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ReferenceArrayPropertyParameterTypesTest.java similarity index 100% rename from generators/src/test/java/com/pholser/junit/quickcheck/ReferenceArrayPropertyParameterTypesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ReferenceArrayPropertyParameterTypesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Repro175.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Repro175.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Repro175.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Repro175.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ResolvingGenericPropertyParameterTypesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ResolvingGenericPropertyParameterTypesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/ResolvingGenericPropertyParameterTypesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ResolvingGenericPropertyParameterTypesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java similarity index 99% rename from core/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java index 7a7c72869..d6bdac09c 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/SamplingButAlsoIncludingAGivenSetTest.java @@ -35,13 +35,11 @@ a copy of this software and associated documentation files (the import java.util.HashSet; import java.util.List; import java.util.Objects; -import java.util.Set; import com.pholser.junit.quickcheck.conversion.StringConversion; import com.pholser.junit.quickcheck.generator.Also; import com.pholser.junit.quickcheck.generator.GenerationStatus; import com.pholser.junit.quickcheck.generator.Generator; -import com.pholser.junit.quickcheck.generator.Only; import com.pholser.junit.quickcheck.internal.ReflectionException; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; diff --git a/core/src/test/java/com/pholser/junit/quickcheck/SamplingOnlyFromAGivenSetTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/SamplingOnlyFromAGivenSetTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/SamplingOnlyFromAGivenSetTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/SamplingOnlyFromAGivenSetTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/ShrinkingTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/ShrinkingTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/ShrinkingTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/ShrinkingTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/TimesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/TimesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/TimesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/TimesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/Types.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/Types.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/Types.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/Types.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnPropertyBasedTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnPropertyBasedTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnPropertyBasedTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnPropertyBasedTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnShrinkingPropertyBasedTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnShrinkingPropertyBasedTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnShrinkingPropertyBasedTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnShrinkingPropertyBasedTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnSubclassPropertyTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnSubclassPropertyTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnSubclassPropertyTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnSubclassPropertyTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnTraitBasedPropertyTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnTraitBasedPropertyTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnTraitBasedPropertyTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/UsualJUnitMachineryOnTraitBasedPropertyTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/UtilityClassesUninstantiabilityHarness.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/UtilityClassesUninstantiabilityHarness.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/UtilityClassesUninstantiabilityHarness.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/UtilityClassesUninstantiabilityHarness.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/ArrayOfBoxOfHuhPropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/ArrayOfBoxOfHuhPropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/ArrayOfBoxOfHuhPropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/ArrayOfBoxOfHuhPropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/BoxOfSuperLongPropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/BoxOfSuperLongPropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/BoxOfSuperLongPropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/BoxOfSuperLongPropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/GenFrequencyTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenFrequencyTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/GenFrequencyTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenFrequencyTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/GenOneOfTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenOneOfTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/GenOneOfTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenOneOfTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/GenerationStatusOnPropertyParametersTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenerationStatusOnPropertyParametersTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/GenerationStatusOnPropertyParametersTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/GenerationStatusOnPropertyParametersTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java similarity index 96% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java index 63e48c60b..83f3ade78 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/LambdasTest.java @@ -30,6 +30,7 @@ a copy of this software and associated documentation files (the import com.pholser.junit.quickcheck.internal.GeometricDistribution; import com.pholser.junit.quickcheck.internal.generator.SimpleGenerationStatus; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.test.generator.ABool; import com.pholser.junit.quickcheck.test.generator.AnInt; @@ -53,7 +54,7 @@ public class LambdasTest { @SuppressWarnings("unchecked") @Before public void setUp() { returnValueGenerator = new ABool(); - random = new SourceOfRandomness(new Random()); + random = new DefaultSourceOfRandomness(new Random()); random.setSeed(-1L); status = new SimpleGenerationStatus(new GeometricDistribution(), random, 0); diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/LambdasUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/LambdasUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/LambdasUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/LambdasUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/PrimitiveIntegerArrayPropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/PrimitiveIntegerArrayPropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/PrimitiveIntegerArrayPropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/PrimitiveIntegerArrayPropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/PropertyParameterGenerationStatusTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/PropertyParameterGenerationStatusTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/PropertyParameterGenerationStatusTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/PropertyParameterGenerationStatusTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/SizeConstrainedPrimitiveIntegerArrayPropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/SizeConstrainedPrimitiveIntegerArrayPropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/SizeConstrainedPrimitiveIntegerArrayPropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/SizeConstrainedPrimitiveIntegerArrayPropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/generator/ThreeDCharArrayPropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/ThreeDCharArrayPropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/generator/ThreeDCharArrayPropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/generator/ThreeDCharArrayPropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/CartesianIteratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/CartesianIteratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/CartesianIteratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/CartesianIteratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ComparablesUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactoryUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactoryUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactoryUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/FakeAnnotatedTypeFactoryUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/GeometricDistributionTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/GeometricDistributionTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/GeometricDistributionTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/GeometricDistributionTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ItemsUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ItemsUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ItemsUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ItemsUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ListsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ListsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ListsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ListsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ListsUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ListsUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ListsUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ListsUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java similarity index 92% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java index 23a775b3b..572e7cd24 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/RangesTest.java @@ -27,6 +27,7 @@ a copy of this software and associated documentation files (the import java.util.Random; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import org.junit.Test; @@ -54,7 +55,7 @@ public class RangesTest { @Test public void weakSanityCheckForDistributionOfChooseLongs() { boolean[] hits = new boolean[5]; - SourceOfRandomness random = new SourceOfRandomness(new Random(0)); + SourceOfRandomness random = new DefaultSourceOfRandomness(new Random(0)); for (int i = 0; i < 100; i++) { hits[(int) Ranges.choose(random, 0, (long) hits.length - 1)] = true; @@ -65,7 +66,7 @@ public class RangesTest { } private void assertRangeOfRandomLong(long min, long max) { - SourceOfRandomness random = new SourceOfRandomness(new Random(0)); + SourceOfRandomness random = new DefaultSourceOfRandomness(new Random(0)); for (int i = 0; i < 1000; i++) { long result = Ranges.choose(random, min, max); assertTrue(min <= result && result <= max); diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/RangesUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/RangesUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/RangesUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/RangesUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/ReflectionUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/SequencesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/SequencesTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/SequencesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/SequencesTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/SequencesUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/SequencesUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/SequencesUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/SequencesUtilityClassTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/WeightedTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/WeightedTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/WeightedTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/WeightedTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/constraint/ConstraintEvaluatorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/constraint/ConstraintEvaluatorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/constraint/ConstraintEvaluatorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/constraint/ConstraintEvaluatorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ArrayGeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ArrayGeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ArrayGeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ArrayGeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/CompositeGeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/CompositeGeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/CompositeGeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/CompositeGeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ConstrainingWhatGeneratorsCanAcceptCertainComponentsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ConstrainingWhatGeneratorsCanAcceptCertainComponentsTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ConstrainingWhatGeneratorsCanAcceptCertainComponentsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ConstrainingWhatGeneratorsCanAcceptCertainComponentsTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/CorePropertyParameterTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/CorePropertyParameterTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/CorePropertyParameterTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/CorePropertyParameterTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/EnumGeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/EnumGeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/EnumGeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/EnumGeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithDiscreteProbabilityTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithDiscreteProbabilityTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithDiscreteProbabilityTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithDiscreteProbabilityTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitGroupOfPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/ExplicitPropertyParameterGeneratorsChosenWithEqualProbabilityTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/Generators.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/Generators.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/Generators.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/Generators.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/MissingGeneratorForGivenTypeTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/MissingGeneratorForGivenTypeTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/MissingGeneratorForGivenTypeTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/MissingGeneratorForGivenTypeTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java similarity index 96% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java index 08e823b7a..b29da349e 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/OneOfSetOfGeneratorsTest.java @@ -29,6 +29,7 @@ a copy of this software and associated documentation files (the import java.util.Random; import com.pholser.junit.quickcheck.generator.Generator; +import com.pholser.junit.quickcheck.random.DefaultSourceOfRandomness; import com.pholser.junit.quickcheck.random.SourceOfRandomness; import com.pholser.junit.quickcheck.test.generator.ABigInt; import com.pholser.junit.quickcheck.test.generator.AByte; @@ -51,7 +52,7 @@ public class OneOfSetOfGeneratorsTest { private SourceOfRandomness random; @Before public void setUp() { - random = new SourceOfRandomness(new Random()); + random = new DefaultSourceOfRandomness(new Random()); repo = new GeneratorRepository(random) .register(new AFloat()) .register(new ADouble()) diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextWithNonShrinkingGeneratorTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextWithNonShrinkingGeneratorTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextWithNonShrinkingGeneratorTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/PropertyParameterGenerationContextWithNonShrinkingGeneratorTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisterGeneratorsByConvention.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisterGeneratorsByConvention.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisterGeneratorsByConvention.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisterGeneratorsByConvention.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfArrayListTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfArrayListTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfArrayListTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfArrayListTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfBigDecimalTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfBigDecimalTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfBigDecimalTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfBigDecimalTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfHashMapTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfHashMapTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfHashMapTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfHashMapTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfInterfaceTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfInterfaceTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfInterfaceTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsForHierarchyOfInterfaceTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsWithServiceLoaderTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsWithServiceLoaderTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsWithServiceLoaderTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/RegisteringGeneratorsWithServiceLoaderTest.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/Convention.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/Convention.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/Convention.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/Convention.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/ConventionGen.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/ConventionGen.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/ConventionGen.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/ConventionGen.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypes.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypes.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypes.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypes.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypesGen.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypesGen.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypesGen.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/GeneratesOtherTypesGen.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGenerator.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGenerator.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGenerator.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGenerator.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGeneratorGen.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGeneratorGen.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGeneratorGen.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/internal/generator/conventiontestclasses/NotAGeneratorGen.java diff --git a/core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java similarity index 97% rename from core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java index 5e532fb91..36762444d 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesFromJavaUtilRandomCloneTest.java @@ -40,7 +40,7 @@ public class GeneratingRandomValuesFromJavaUtilRandomCloneTest { private Random clone; @Before public void beforeEach() { - source = new SourceOfRandomness(new Random()); + source = new DefaultSourceOfRandomness(new Random()); source.setSeed(1L); // mix in some randomness operations so the internal state changes diff --git a/core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java similarity index 99% rename from core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java index 21b882f42..380ea5ef0 100644 --- a/core/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java +++ b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/random/GeneratingRandomValuesTest.java @@ -44,7 +44,7 @@ public class GeneratingRandomValuesTest { private SourceOfRandomness source; @Before public void beforeEach() { - source = new SourceOfRandomness(new Random()); + source = new DefaultSourceOfRandomness(new Random()); source.setSeed(1L); } diff --git a/core/src/test/java/com/pholser/junit/quickcheck/runner/PropertyFalsifiedUtilityClassTest.java b/runner-junit4/src/test/java/com/pholser/junit/quickcheck/runner/PropertyFalsifiedUtilityClassTest.java similarity index 100% rename from core/src/test/java/com/pholser/junit/quickcheck/runner/PropertyFalsifiedUtilityClassTest.java rename to runner-junit4/src/test/java/com/pholser/junit/quickcheck/runner/PropertyFalsifiedUtilityClassTest.java diff --git a/core/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator b/runner-junit4/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator similarity index 100% rename from core/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator rename to runner-junit4/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator diff --git a/core/src/test/resources/logback-test.xml b/runner-junit4/src/test/resources/logback-test.xml similarity index 100% rename from core/src/test/resources/logback-test.xml rename to runner-junit4/src/test/resources/logback-test.xml diff --git a/core/src/test/resources/subclass-property-test-expected.txt b/runner-junit4/src/test/resources/subclass-property-test-expected.txt similarity index 100% rename from core/src/test/resources/subclass-property-test-expected.txt rename to runner-junit4/src/test/resources/subclass-property-test-expected.txt diff --git a/core/src/test/resources/trait-property-test-expected.txt b/runner-junit4/src/test/resources/trait-property-test-expected.txt similarity index 100% rename from core/src/test/resources/trait-property-test-expected.txt rename to runner-junit4/src/test/resources/trait-property-test-expected.txt