├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE.MD ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── gradle.yml │ ├── matrix.js │ └── matrix_builder.js ├── .gitignore ├── .idea └── icon.png ├── BACKLOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FEATURE_USAGE_SURVEY.md ├── LICENSE.md ├── README.md ├── TODO.md ├── api ├── build.gradle └── src │ └── main │ ├── java │ └── net │ │ └── jqwik │ │ └── api │ │ ├── AfterFailureMode.java │ │ ├── Arbitraries.java │ │ ├── Arbitrary.java │ │ ├── ArbitrarySupplier.java │ │ ├── Assume.java │ │ ├── Builders.java │ │ ├── CannotFindArbitraryException.java │ │ ├── Combinators.java │ │ ├── Data.java │ │ ├── Disabled.java │ │ ├── EdgeCases.java │ │ ├── EdgeCasesMode.java │ │ ├── Example.java │ │ ├── ExhaustiveGenerator.java │ │ ├── FacadeLoader.java │ │ ├── Falsifier.java │ │ ├── FixedSeedMode.java │ │ ├── ForAll.java │ │ ├── From.java │ │ ├── FromData.java │ │ ├── Functions.java │ │ ├── GenerationMode.java │ │ ├── Group.java │ │ ├── JavaBeanReportingFormat.java │ │ ├── JqwikException.java │ │ ├── Label.java │ │ ├── Property.java │ │ ├── PropertyDefaults.java │ │ ├── Provide.java │ │ ├── RandomDistribution.java │ │ ├── RandomGenerator.java │ │ ├── Report.java │ │ ├── Reporter.java │ │ ├── Reporting.java │ │ ├── SampleReportingFormat.java │ │ ├── Shrinkable.java │ │ ├── ShrinkingDistance.java │ │ ├── ShrinkingDistanceArraysSupport.java │ │ ├── ShrinkingMode.java │ │ ├── Table.java │ │ ├── Tag.java │ │ ├── TagList.java │ │ ├── TooManyFilterMissesException.java │ │ ├── Tuple.java │ │ ├── arbitraries │ │ ├── ArbitraryDecorator.java │ │ ├── ArrayArbitrary.java │ │ ├── BigDecimalArbitrary.java │ │ ├── BigIntegerArbitrary.java │ │ ├── ByteArbitrary.java │ │ ├── CharacterArbitrary.java │ │ ├── DoubleArbitrary.java │ │ ├── FloatArbitrary.java │ │ ├── FunctionArbitrary.java │ │ ├── IntegerArbitrary.java │ │ ├── IteratorArbitrary.java │ │ ├── ListArbitrary.java │ │ ├── LongArbitrary.java │ │ ├── MapArbitrary.java │ │ ├── NumericalArbitrary.java │ │ ├── SetArbitrary.java │ │ ├── ShortArbitrary.java │ │ ├── SizableArbitrary.java │ │ ├── StreamArbitrary.java │ │ ├── StreamableArbitrary.java │ │ ├── StringArbitrary.java │ │ ├── TraverseArbitrary.java │ │ ├── TypeArbitrary.java │ │ └── package-info.java │ │ ├── configurators │ │ ├── ArbitraryConfigurationException.java │ │ ├── ArbitraryConfigurator.java │ │ ├── ArbitraryConfiguratorBase.java │ │ ├── SelfConfiguringArbitrary.java │ │ └── package-info.java │ │ ├── constraints │ │ ├── AlphaChars.java │ │ ├── BigRange.java │ │ ├── ByteRange.java │ │ ├── CharRange.java │ │ ├── CharRangeList.java │ │ ├── Chars.java │ │ ├── CharsList.java │ │ ├── DoubleRange.java │ │ ├── FloatRange.java │ │ ├── IntRange.java │ │ ├── LongRange.java │ │ ├── LowerChars.java │ │ ├── Negative.java │ │ ├── NotBlank.java │ │ ├── NotEmpty.java │ │ ├── NumericChars.java │ │ ├── Positive.java │ │ ├── Scale.java │ │ ├── ShortRange.java │ │ ├── Size.java │ │ ├── StringLength.java │ │ ├── UniqueChars.java │ │ ├── UniqueElements.java │ │ ├── UpperChars.java │ │ ├── UseType.java │ │ ├── UseTypeMode.java │ │ ├── Whitespace.java │ │ ├── WithNull.java │ │ └── package-info.java │ │ ├── domains │ │ ├── Domain.java │ │ ├── DomainContext.java │ │ ├── DomainContextBase.java │ │ ├── DomainList.java │ │ └── package-info.java │ │ ├── facades │ │ ├── ReflectionSupportFacade.java │ │ ├── ShrinkingSupportFacade.java │ │ ├── TestingSupportFacade.java │ │ └── package-info.java │ │ ├── footnotes │ │ ├── EnableFootnotes.java │ │ ├── Footnotes.java │ │ ├── FootnotesHook.java │ │ └── package-info.java │ │ ├── lifecycle │ │ ├── AddLifecycleHook.java │ │ ├── AfterContainer.java │ │ ├── AfterContainerHook.java │ │ ├── AfterExample.java │ │ ├── AfterProperty.java │ │ ├── AfterTry.java │ │ ├── AroundContainerHook.java │ │ ├── AroundPropertyHook.java │ │ ├── AroundTryHook.java │ │ ├── BeforeContainer.java │ │ ├── BeforeContainerHook.java │ │ ├── BeforeExample.java │ │ ├── BeforeProperty.java │ │ ├── BeforeTry.java │ │ ├── CannotFindStoreException.java │ │ ├── CannotResolveParameterException.java │ │ ├── ContainerLifecycleContext.java │ │ ├── FalsifiedSample.java │ │ ├── InvokePropertyMethodHook.java │ │ ├── LifecycleContext.java │ │ ├── LifecycleHook.java │ │ ├── LifecycleHooks.java │ │ ├── Lifespan.java │ │ ├── MethodLifecycleContext.java │ │ ├── ParameterResolutionContext.java │ │ ├── PerProperty.java │ │ ├── PropagationMode.java │ │ ├── PropertyAttributes.java │ │ ├── PropertyExecutionResult.java │ │ ├── PropertyExecutor.java │ │ ├── PropertyLifecycleContext.java │ │ ├── ProvidePropertyInstanceHook.java │ │ ├── RegistrarHook.java │ │ ├── ResolveParameterHook.java │ │ ├── ShrunkFalsifiedSample.java │ │ ├── SkipExecutionHook.java │ │ ├── Store.java │ │ ├── TryExecutionResult.java │ │ ├── TryExecutor.java │ │ ├── TryLifecycleContext.java │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── providers │ │ ├── ArbitraryProvider.java │ │ ├── TypeUsage.java │ │ └── package-info.java │ │ ├── sessions │ │ ├── JqwikSession.java │ │ └── package-info.java │ │ ├── state │ │ ├── Action.java │ │ ├── ActionBuilder.java │ │ ├── ActionChain.java │ │ ├── ActionChainArbitrary.java │ │ ├── Chain.java │ │ ├── ChainArbitrary.java │ │ ├── ChangeDetector.java │ │ ├── Transformation.java │ │ ├── Transformer.java │ │ └── package-info.java │ │ ├── stateful │ │ ├── Action.java │ │ ├── ActionSequence.java │ │ ├── ActionSequenceArbitrary.java │ │ ├── Invariant.java │ │ └── package-info.java │ │ ├── statistics │ │ ├── Histogram.java │ │ ├── NumberRangeHistogram.java │ │ ├── Statistics.java │ │ ├── StatisticsCollector.java │ │ ├── StatisticsCoverage.java │ │ ├── StatisticsEntry.java │ │ ├── StatisticsReport.java │ │ ├── StatisticsReportFormat.java │ │ ├── StatisticsReportList.java │ │ └── package-info.java │ │ └── support │ │ ├── CollectorsSupport.java │ │ ├── ExceptionSupport.java │ │ ├── HashCodeSupport.java │ │ ├── LambdaSupport.java │ │ └── package-info.java │ └── module │ └── module-info.java ├── base ├── build.gradle └── src │ └── main │ └── module │ └── module-info.java ├── build.gradle ├── buildSrc ├── build.gradle └── src │ └── main │ └── groovy │ ├── jqwik.common-configuration.gradle │ └── jqwik.module-configuration.gradle ├── dependencies.gradle ├── documentation ├── README.md ├── build.gradle └── src │ ├── docs │ ├── include │ │ ├── api-evolution.md │ │ ├── assumptions.md │ │ ├── collecting-and-reporting-statistics.md │ │ ├── combining-arbitraries.md │ │ ├── contract-tests.md │ │ ├── customized-parameter-generation.md │ │ ├── data-driven-properties.md │ │ ├── default-parameter-generation.md │ │ ├── domain-and-domain-context.md │ │ ├── exhaustive-generation.md │ │ ├── generation-from-type.md │ │ ├── generation-of-edge-cases.md │ │ ├── how-to-use.md │ │ ├── implement-your-own.md │ │ ├── jqwik-configuration.md │ │ ├── kotlin-module.md │ │ ├── lifecycle-hooks.md │ │ ├── providing-default-arbitraries.md │ │ ├── recursive-arbitraries.md │ │ ├── rerunning-falsified-properties.md │ │ ├── result-shrinking.md │ │ ├── stateful-testing-old.md │ │ ├── stateful-testing.md │ │ ├── testing-module.md │ │ ├── time-module.md │ │ ├── using-arbitraries-directly.md │ │ ├── web-module.md │ │ └── writing-properties.md │ ├── index.template.html │ └── user-guide.template.md │ └── test │ ├── java │ └── net │ │ └── jqwik │ │ ├── MakeGradleHappyTests.java │ │ └── docs │ │ ├── ArbitrarySupplierExamples.java │ │ ├── AssumptionExamples.java │ │ ├── BuildersExamples.java │ │ ├── ChoosingExamples.java │ │ ├── CombinatorsExamples.java │ │ ├── DataDrivenPropertyExamples.java │ │ ├── DatesExamples.java │ │ ├── EdgeCasesExamples.java │ │ ├── ExampleBasedTests.java │ │ ├── ExhaustiveGenerationExamples.java │ │ ├── FizzBuzzTests.java │ │ ├── FlatMappingExamples.java │ │ ├── FluentConfigurationExamples.java │ │ ├── ForEachValueExamples.java │ │ ├── FrequencyOfExamples.java │ │ ├── FunctionalTypeExamples.java │ │ ├── GermanText.java │ │ ├── InjectDuplicateExamples.java │ │ ├── MappingExamples.java │ │ ├── MapsExamples.java │ │ ├── NamingExamples.java │ │ ├── OneOfExamples.java │ │ ├── PropertyBasedTests.java │ │ ├── PropertyDefaultsExamples.java │ │ ├── ProvideMethodExamples.java │ │ ├── RandomDistributionExamples.java │ │ ├── RecursiveExamples.java │ │ ├── SamplingExamples.java │ │ ├── SelfMadeAnnotationExamples.java │ │ ├── ShrinkingExamples.java │ │ ├── ShrinkingFilterExamples.java │ │ ├── ShrinkingTargetExamples.java │ │ ├── SimpleExampleTests.java │ │ ├── SimpleLifecycleTests.java │ │ ├── TaggingExamples.java │ │ ├── TestsWithGroups.java │ │ ├── UniquenessExamples.java │ │ ├── VariableTypedPropertyExamples.java │ │ ├── arbitraryconfigurator │ │ ├── NotNull.java │ │ ├── NotNullConfigurator.java │ │ ├── NotNullProperties.java │ │ ├── Odd.java │ │ ├── OddConfigurator.java │ │ └── OddProperties.java │ │ ├── arbitrarydecorator │ │ ├── ArbitraryDecoratorExamples.java │ │ ├── ComplexNumber.java │ │ └── ComplexNumberArbitrary.java │ │ ├── contracts │ │ ├── ComparatorContract.java │ │ ├── StringCaseInsensitiveProperties.java │ │ └── eurocalc │ │ │ ├── ConstrainedBy.java │ │ │ ├── Constraint.java │ │ │ ├── ContractFor.java │ │ │ ├── EuroConverter.java │ │ │ ├── RateProvider.java │ │ │ ├── RateProviderContractProperties.java │ │ │ └── SimpleRateProvider.java │ │ ├── defaultprovider │ │ ├── AlternativeStringArbitraryProvider.java │ │ ├── Money.java │ │ ├── MoneyArbitraryProvider.java │ │ ├── MoneyProperties.java │ │ └── StringProperties.java │ │ ├── domains │ │ ├── Address.java │ │ ├── AddressProperties.java │ │ ├── AmericanAddresses.java │ │ ├── City.java │ │ ├── State.java │ │ └── Street.java │ │ ├── footnotes │ │ └── FootnotesExamples.java │ │ ├── kotlin │ │ ├── CombineExamples.kt │ │ ├── CoroutineExamples.kt │ │ ├── GroupingExamples.kt │ │ ├── InlineClassExamples.kt │ │ ├── KotlinFunctionExamples.kt │ │ ├── KotlinSingletonExample.kt │ │ ├── NullabilityExamples.kt │ │ └── UseTypeWithDataclassesExamples.kt │ │ ├── lifecycle │ │ ├── AroundContainerHookExamples.java │ │ ├── AroundPropertyHookExamples.java │ │ ├── AroundTryHookExamples.java │ │ ├── BeforeTryMemberExample.java │ │ ├── FullLifecycleExamples.java │ │ ├── LifecycleStorageExamples.java │ │ ├── PerPropertyLifecycleExamples.java │ │ ├── ResolveParameterHookExamples.java │ │ ├── SkipExecutionHookExample.java │ │ ├── Timing.java │ │ └── TimingExtensionExamples.java │ │ ├── reporting │ │ └── SampleReportingExamples.java │ │ ├── state │ │ ├── RegexChainExample.java │ │ ├── mystack │ │ │ ├── MyStringStack.java │ │ │ └── MyStringStackExamples.java │ │ └── mystore │ │ │ ├── MyStore.java │ │ │ └── MyStoreExamples.java │ │ ├── stateful │ │ └── mystack │ │ │ ├── ClearAction.java │ │ │ ├── MyStringStack.java │ │ │ ├── MyStringStackProperties.java │ │ │ ├── PopAction.java │ │ │ └── PushAction.java │ │ ├── statistics │ │ ├── HistogramExamples.java │ │ ├── StatisticsCoverageExamples.java │ │ ├── StatisticsExamples.java │ │ └── StatisticsReportingExamples.java │ │ ├── time │ │ └── DateTimeExamples.java │ │ ├── types │ │ ├── Party.java │ │ ├── Person.java │ │ └── TypeArbitraryExamples.java │ │ └── web │ │ ├── EmailExamples.java │ │ └── WebDomainExamples.java │ └── resources │ ├── META-INF │ └── services │ │ ├── net.jqwik.api.SampleReportingFormat │ │ ├── net.jqwik.api.configurators.ArbitraryConfigurator │ │ └── net.jqwik.api.providers.ArbitraryProvider │ ├── junit-platform.properties │ └── log4j2-test.xml ├── engine ├── build.gradle └── src │ ├── main │ ├── java │ │ └── net │ │ │ └── jqwik │ │ │ └── engine │ │ │ ├── ArbitraryDelegator.java │ │ │ ├── DefaultJqwikConfiguration.java │ │ │ ├── JqwikConfiguration.java │ │ │ ├── JqwikProperties.java │ │ │ ├── JqwikTestEngine.java │ │ │ ├── PropertyAttributesDefaults.java │ │ │ ├── SourceOfRandomness.java │ │ │ ├── TestEngineConfiguration.java │ │ │ ├── descriptor │ │ │ ├── AbstractMethodDescriptor.java │ │ │ ├── ContainerClassDescriptor.java │ │ │ ├── DiscoverySupport.java │ │ │ ├── JqwikDescriptor.java │ │ │ ├── JqwikEngineDescriptor.java │ │ │ ├── PropertyConfiguration.java │ │ │ ├── PropertyMethodDescriptor.java │ │ │ ├── SkipExecutionDecorator.java │ │ │ └── package-info.java │ │ │ ├── discovery │ │ │ ├── AbstractClassResolver.java │ │ │ ├── DefaultPropertyAttributes.java │ │ │ ├── ElementResolver.java │ │ │ ├── GroupContainerResolver.java │ │ │ ├── HierarchicalJavaResolver.java │ │ │ ├── JqwikDiscoverer.java │ │ │ ├── JqwikUniqueIDs.java │ │ │ ├── PropertyMethodResolver.java │ │ │ ├── TopLevelContainerResolver.java │ │ │ ├── package-info.java │ │ │ ├── predicates │ │ │ │ ├── IsContainerAGroup.java │ │ │ │ ├── IsDiscoverableTestMethod.java │ │ │ │ ├── IsMethodAnnotatedWithProperty.java │ │ │ │ ├── IsPotentialTestContainer.java │ │ │ │ ├── IsProperty.java │ │ │ │ ├── IsScannableContainerClass.java │ │ │ │ ├── IsTestContainer.java │ │ │ │ ├── IsTopLevelClass.java │ │ │ │ └── package-info.java │ │ │ └── specs │ │ │ │ ├── DiscoverySpec.java │ │ │ │ ├── GroupDiscoverySpec.java │ │ │ │ ├── PropertyDiscoverySpec.java │ │ │ │ ├── TopLevelContainerDiscoverySpec.java │ │ │ │ └── package-info.java │ │ │ ├── execution │ │ │ ├── AbstractLifecycleContext.java │ │ │ ├── AfterFailureParametersGenerator.java │ │ │ ├── CachingArbitraryResolver.java │ │ │ ├── CheckedProperty.java │ │ │ ├── CheckedPropertyFactory.java │ │ │ ├── CombinedDomainContext.java │ │ │ ├── ContainerInstancesCreator.java │ │ │ ├── ContainerTaskCreator.java │ │ │ ├── DefaultContainerLifecycleContext.java │ │ │ ├── DefaultParameterInjectionContext.java │ │ │ ├── DefaultPropertyLifecycleContext.java │ │ │ ├── DefaultTryLifecycleContext.java │ │ │ ├── DomainContextFactory.java │ │ │ ├── EngineLifecycleContext.java │ │ │ ├── ExecutionTaskCreator.java │ │ │ ├── GenerationInfo.java │ │ │ ├── JqwikExecutor.java │ │ │ ├── LifecycleContextSupport.java │ │ │ ├── ParameterSupplierResolver.java │ │ │ ├── ParametersGenerator.java │ │ │ ├── PropertyExecutionListener.java │ │ │ ├── PropertyMethodExecutor.java │ │ │ ├── PropertyTaskCreator.java │ │ │ ├── RecordingExecutionListener.java │ │ │ ├── ReportEntrySupport.java │ │ │ ├── ResolvingParametersGenerator.java │ │ │ ├── ShrinkableResolvedParameter.java │ │ │ ├── lifecycle │ │ │ │ ├── AroundTryLifecycle.java │ │ │ │ ├── CombinedResolveParameterHook.java │ │ │ │ ├── ContainerInstances.java │ │ │ │ ├── CurrentDomainContext.java │ │ │ │ ├── CurrentTestDescriptor.java │ │ │ │ ├── ExtendedPropertyExecutionResult.java │ │ │ │ ├── HookSupport.java │ │ │ │ ├── JqwikLifecycleRegistrator.java │ │ │ │ ├── LifecycleHooksRegistry.java │ │ │ │ ├── LifecycleHooksSupplier.java │ │ │ │ ├── OutsideJqwikException.java │ │ │ │ ├── PlainExecutionResult.java │ │ │ │ ├── RegisteredLifecycleHooks.java │ │ │ │ ├── ScopedStore.java │ │ │ │ ├── StoreRepository.java │ │ │ │ ├── TryLifecycleExecutor.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── pipeline │ │ │ │ ├── DuplicateExecutionTaskException.java │ │ │ │ ├── ExecutionPipeline.java │ │ │ │ ├── ExecutionTask.java │ │ │ │ ├── Pipeline.java │ │ │ │ ├── PredecessorNotSubmittedException.java │ │ │ │ ├── TaskExecutionResult.java │ │ │ │ └── package-info.java │ │ │ └── reporting │ │ │ │ ├── ArrayReportingFormat.java │ │ │ │ ├── BuilderBasedLineReporter.java │ │ │ │ ├── CircularDependencyReport.java │ │ │ │ ├── CollectionValueReport.java │ │ │ │ ├── DefaultReporter.java │ │ │ │ ├── ExecutionResultReport.java │ │ │ │ ├── LineReporter.java │ │ │ │ ├── MapValueReport.java │ │ │ │ ├── NullReportingFormat.java │ │ │ │ ├── ObjectValueReport.java │ │ │ │ ├── OptionalReportingFormat.java │ │ │ │ ├── ParameterChangesDetector.java │ │ │ │ ├── SampleReporter.java │ │ │ │ ├── SampleReportingFormats.java │ │ │ │ ├── StreamReportingFormat.java │ │ │ │ ├── TupleValueReport.java │ │ │ │ ├── ValueReport.java │ │ │ │ └── package-info.java │ │ │ ├── facades │ │ │ ├── ActionChainFacadeImpl.java │ │ │ ├── ArbitrariesFacadeImpl.java │ │ │ ├── ArbitraryFacadeImpl.java │ │ │ ├── ChainFacadeImpl.java │ │ │ ├── CombinatorsFacadeImpl.java │ │ │ ├── DomainContextFacadeImpl.java │ │ │ ├── EdgeCasesFacadeImpl.java │ │ │ ├── ExhaustiveGeneratorFacadeImpl.java │ │ │ ├── FunctionsFacadeImpl.java │ │ │ ├── JavaBeanReportingFormatFacadeImpl.java │ │ │ ├── JqwikSessionFacadeImpl.java │ │ │ ├── Memoize.java │ │ │ ├── RandomDistributionFacadeImpl.java │ │ │ ├── RandomGeneratorFacadeImpl.java │ │ │ ├── ReflectionSupportFacadeImpl.java │ │ │ ├── RegisteredTypeUsageEnhancers.java │ │ │ ├── SampleStreamFacade.java │ │ │ ├── ShrinkableFacadeImpl.java │ │ │ ├── ShrinkingSupportFacadeImpl.java │ │ │ ├── StatisticsFacadeImpl.java │ │ │ ├── StoreFacadeImpl.java │ │ │ ├── TestingSupportFacadeImpl.java │ │ │ ├── TypeUsageFacadeImpl.java │ │ │ └── package-info.java │ │ │ ├── hooks │ │ │ ├── DisabledHook.java │ │ │ ├── Hooks.java │ │ │ ├── ResolveReporterHook.java │ │ │ ├── lifecycle │ │ │ │ ├── AutoCloseableHook.java │ │ │ │ ├── BeforeTryMembersHook.java │ │ │ │ ├── ContainerLifecycleMethodsHook.java │ │ │ │ ├── LifecycleMethods.java │ │ │ │ ├── MethodParameterResolver.java │ │ │ │ ├── PropertyLifecycleMethodsHook.java │ │ │ │ ├── TryLifecycleMethodsHook.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── statistics │ │ │ │ ├── StandardStatisticsReportFormat.java │ │ │ │ ├── StatisticsCollectorImpl.java │ │ │ │ ├── StatisticsEntryImpl.java │ │ │ │ ├── StatisticsHook.java │ │ │ │ ├── StatisticsPublisher.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── properties │ │ │ ├── ArbitraryResolver.java │ │ │ ├── CheckedFunction.java │ │ │ ├── DataBasedShrinkablesGenerator.java │ │ │ ├── DataResolver.java │ │ │ ├── DefaultArbitraries.java │ │ │ ├── DomainContextBaseConfigurators.java │ │ │ ├── DomainContextBaseProviders.java │ │ │ ├── DomainContextBaseReportingFormats.java │ │ │ ├── EdgeCasesGenerator.java │ │ │ ├── ExhaustiveShrinkablesGenerator.java │ │ │ ├── FailOnFixedSeedException.java │ │ │ ├── FalsifiedSampleImpl.java │ │ │ ├── FeatureExtractor.java │ │ │ ├── ForAllParametersGenerator.java │ │ │ ├── GenericProperty.java │ │ │ ├── IncompatibleDataException.java │ │ │ ├── InstanceBasedSubtypeProvider.java │ │ │ ├── PropertyCheckResult.java │ │ │ ├── PropertyMethodArbitraryResolver.java │ │ │ ├── PropertyMethodDataResolver.java │ │ │ ├── ProviderMethod.java │ │ │ ├── PurelyRandomShrinkablesGenerator.java │ │ │ ├── RandomizedParameterGenerator.java │ │ │ ├── RandomizedShrinkablesGenerator.java │ │ │ ├── Range.java │ │ │ ├── RegisteredArbitraryConfigurer.java │ │ │ ├── RegisteredArbitraryResolver.java │ │ │ ├── ShrunkFalsifiedSampleImpl.java │ │ │ ├── UniquenessChecker.java │ │ │ ├── arbitraries │ │ │ │ ├── ArbitrariesSupport.java │ │ │ │ ├── ArbitraryCollect.java │ │ │ │ ├── ArbitraryFilter.java │ │ │ │ ├── ArbitraryFlatMap.java │ │ │ │ ├── ArbitraryMap.java │ │ │ │ ├── CharacterRangeArbitrary.java │ │ │ │ ├── ChooseCharacterArbitrary.java │ │ │ │ ├── ChooseValueArbitrary.java │ │ │ │ ├── CreateArbitrary.java │ │ │ │ ├── DecimalEdgeCasesConfiguration.java │ │ │ │ ├── DecimalGeneratingArbitrary.java │ │ │ │ ├── DefaultArrayArbitrary.java │ │ │ │ ├── DefaultBigDecimalArbitrary.java │ │ │ │ ├── DefaultBigIntegerArbitrary.java │ │ │ │ ├── DefaultByteArbitrary.java │ │ │ │ ├── DefaultCharacterArbitrary.java │ │ │ │ ├── DefaultDoubleArbitrary.java │ │ │ │ ├── DefaultFloatArbitrary.java │ │ │ │ ├── DefaultFunctionArbitrary.java │ │ │ │ ├── DefaultIntegerArbitrary.java │ │ │ │ ├── DefaultIteratorArbitrary.java │ │ │ │ ├── DefaultListArbitrary.java │ │ │ │ ├── DefaultLongArbitrary.java │ │ │ │ ├── DefaultMapArbitrary.java │ │ │ │ ├── DefaultSetArbitrary.java │ │ │ │ ├── DefaultShortArbitrary.java │ │ │ │ ├── DefaultStreamArbitrary.java │ │ │ │ ├── DefaultStringArbitrary.java │ │ │ │ ├── DefaultTraverseArbitrary.java │ │ │ │ ├── DefaultTypeArbitrary.java │ │ │ │ ├── EdgeCasesSupport.java │ │ │ │ ├── FrequencyArbitrary.java │ │ │ │ ├── FrequencyOfArbitrary.java │ │ │ │ ├── FromGeneratorWithSizeArbitrary.java │ │ │ │ ├── GenericEdgeCasesConfiguration.java │ │ │ │ ├── IntegralEdgeCasesConfiguration.java │ │ │ │ ├── IntegralGeneratingArbitrary.java │ │ │ │ ├── JustArbitrary.java │ │ │ │ ├── LazyArbitrary.java │ │ │ │ ├── LazyOfArbitrary.java │ │ │ │ ├── MappedEdgeCasesConsumer.java │ │ │ │ ├── MultivalueArbitraryBase.java │ │ │ │ ├── NotAFunctionalTypeException.java │ │ │ │ ├── OneOfArbitrary.java │ │ │ │ ├── RecursiveArbitrary.java │ │ │ │ ├── ReportableStream.java │ │ │ │ ├── ShuffleArbitrary.java │ │ │ │ ├── TypedCloneable.java │ │ │ │ ├── UseGeneratorsArbitrary.java │ │ │ │ ├── combinations │ │ │ │ │ ├── CombineArbitrary.java │ │ │ │ │ ├── DefaultCombinator2.java │ │ │ │ │ ├── DefaultCombinator3.java │ │ │ │ │ ├── DefaultCombinator4.java │ │ │ │ │ ├── DefaultCombinator5.java │ │ │ │ │ ├── DefaultCombinator6.java │ │ │ │ │ ├── DefaultCombinator7.java │ │ │ │ │ ├── DefaultCombinator8.java │ │ │ │ │ ├── DefaultListCombinator.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── exhaustive │ │ │ │ │ ├── CombinedExhaustiveGenerator.java │ │ │ │ │ ├── ExhaustiveGenerators.java │ │ │ │ │ ├── FilteredExhaustiveGenerator.java │ │ │ │ │ ├── FlatMappedExhaustiveGenerator.java │ │ │ │ │ ├── IgnoreExceptionExhaustiveGenerator.java │ │ │ │ │ ├── IterableBasedExhaustiveGenerator.java │ │ │ │ │ ├── ListExhaustiveGenerator.java │ │ │ │ │ ├── MappedExhaustiveGenerator.java │ │ │ │ │ ├── PermutationExhaustiveGenerator.java │ │ │ │ │ ├── SetExhaustiveGenerator.java │ │ │ │ │ ├── WithNullExhaustiveGenerator.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── randomized │ │ │ │ │ ├── AbstractFunctionGenerator.java │ │ │ │ │ ├── BiasedNumericGenerator.java │ │ │ │ │ ├── BiasedPartitionPointsCalculator.java │ │ │ │ │ ├── BiasedRandomDistribution.java │ │ │ │ │ ├── BigUniformNumericGenerator.java │ │ │ │ │ ├── CollectGenerator.java │ │ │ │ │ ├── ConstantFunctionGenerator.java │ │ │ │ │ ├── ContainerGenerator.java │ │ │ │ │ ├── DefaultMethodHandleFactory.java │ │ │ │ │ ├── FilteredGenerator.java │ │ │ │ │ ├── FrequencyGenerator.java │ │ │ │ │ ├── FunctionGenerator.java │ │ │ │ │ ├── GaussianNumericGenerator.java │ │ │ │ │ ├── GaussianRandomDistribution.java │ │ │ │ │ ├── IgnoreExceptionGenerator.java │ │ │ │ │ ├── InjectDuplicatesGenerator.java │ │ │ │ │ ├── RandomDecimalGenerators.java │ │ │ │ │ ├── RandomGenerators.java │ │ │ │ │ ├── RandomIntegralGenerators.java │ │ │ │ │ ├── SizeGenerator.java │ │ │ │ │ ├── SmallUniformNumericGenerator.java │ │ │ │ │ ├── UniformRandomDistribution.java │ │ │ │ │ ├── WithEdgeCasesGenerator.java │ │ │ │ │ └── package-info.java │ │ │ ├── configurators │ │ │ │ ├── BigDecimalRangeConfigurator.java │ │ │ │ ├── BigIntegerRangeConfigurator.java │ │ │ │ ├── ByteRangeConfigurator.java │ │ │ │ ├── CharsConfigurator.java │ │ │ │ ├── DoubleRangeConfigurator.java │ │ │ │ ├── FloatRangeConfigurator.java │ │ │ │ ├── IntRangeConfigurator.java │ │ │ │ ├── LongRangeConfigurator.java │ │ │ │ ├── NegativeConfigurator.java │ │ │ │ ├── NotBlankConfigurator.java │ │ │ │ ├── PositiveConfigurator.java │ │ │ │ ├── RegisteredArbitraryConfigurators.java │ │ │ │ ├── ScaleConfigurator.java │ │ │ │ ├── ShortRangeConfigurator.java │ │ │ │ ├── SizeConfigurator.java │ │ │ │ ├── StringLengthConfigurator.java │ │ │ │ ├── UniqueCharsConfigurator.java │ │ │ │ ├── UniqueElementsConfigurator.java │ │ │ │ ├── WhitespaceConfigurator.java │ │ │ │ ├── WithNullConfigurator.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── shrinking │ │ │ │ ├── AbstractSampleShrinker.java │ │ │ │ ├── AbstractValueShrinkable.java │ │ │ │ ├── AggressiveSizeOfListShrinker.java │ │ │ │ ├── BigIntegerGrower.java │ │ │ │ ├── BigIntegerShrinker.java │ │ │ │ ├── ChooseValueShrinkable.java │ │ │ │ ├── CollectShrinkable.java │ │ │ │ ├── CombinedShrinkable.java │ │ │ │ ├── ErrorEquivalenceChecker.java │ │ │ │ ├── FilteredShrinkable.java │ │ │ │ ├── FixedValueFlatMappedShrinkable.java │ │ │ │ ├── FlatMappedShrinkable.java │ │ │ │ ├── IgnoreExceptionShrinkable.java │ │ │ │ ├── LazyOfShrinkable.java │ │ │ │ ├── MappedShrinkable.java │ │ │ │ ├── OneAfterTheOtherParameterShrinker.java │ │ │ │ ├── PairwiseParameterShrinker.java │ │ │ │ ├── PropertyShrinker.java │ │ │ │ ├── SampleShrinkable.java │ │ │ │ ├── ShrinkAndGrowShrinker.java │ │ │ │ ├── ShrinkableBigInteger.java │ │ │ │ ├── ShrinkableContainer.java │ │ │ │ ├── ShrinkableList.java │ │ │ │ ├── ShrinkableSet.java │ │ │ │ ├── ShrinkableString.java │ │ │ │ ├── ShrinkingAlgorithm.java │ │ │ │ ├── ShrinkingCommons.java │ │ │ │ ├── ShrunkSampleRecreator.java │ │ │ │ ├── SizeOfListShrinker.java │ │ │ │ ├── Unshrinkable.java │ │ │ │ └── package-info.java │ │ │ ├── state │ │ │ │ ├── DefaultActionChainArbitrary.java │ │ │ │ ├── DefaultChainArbitrary.java │ │ │ │ ├── InvariantFailedError.java │ │ │ │ ├── SequentialActionChain.java │ │ │ │ ├── ShrinkableChain.java │ │ │ │ ├── ShrinkableChainIteration.java │ │ │ │ ├── ShrinkableChainShrinker.java │ │ │ │ └── package-info.java │ │ │ └── stateful │ │ │ │ ├── ActionGenerator.java │ │ │ │ ├── ActionSequenceGenerator.java │ │ │ │ ├── ActionSequenceReportingFormat.java │ │ │ │ ├── ComprehensiveSizeOfListShrinker.java │ │ │ │ ├── DefaultActionSequenceArbitrary.java │ │ │ │ ├── InvariantFailedError.java │ │ │ │ ├── RandomActionGenerator.java │ │ │ │ ├── SequentialActionSequence.java │ │ │ │ ├── ShrinkableActionSequence.java │ │ │ │ ├── ShrinkablesActionGenerator.java │ │ │ │ └── package-info.java │ │ │ ├── providers │ │ │ ├── AbstractCollectionArbitraryProvider.java │ │ │ ├── ArbitraryArbitraryProvider.java │ │ │ ├── ArrayArbitraryProvider.java │ │ │ ├── BigDecimalArbitraryProvider.java │ │ │ ├── BigIntegerArbitraryProvider.java │ │ │ ├── BooleanArbitraryProvider.java │ │ │ ├── ByteArbitraryProvider.java │ │ │ ├── CharacterArbitraryProvider.java │ │ │ ├── DoubleArbitraryProvider.java │ │ │ ├── EntryArbitraryProvider.java │ │ │ ├── EnumArbitraryProvider.java │ │ │ ├── FloatArbitraryProvider.java │ │ │ ├── FunctionArbitraryProvider.java │ │ │ ├── HashMapArbitraryProvider.java │ │ │ ├── IntegerArbitraryProvider.java │ │ │ ├── IteratorArbitraryProvider.java │ │ │ ├── ListArbitraryProvider.java │ │ │ ├── LongArbitraryProvider.java │ │ │ ├── NullableArbitraryProvider.java │ │ │ ├── ObjectArbitraryProvider.java │ │ │ ├── OptionalArbitraryProvider.java │ │ │ ├── RandomArbitraryProvider.java │ │ │ ├── RegisteredArbitraryProviders.java │ │ │ ├── SetArbitraryProvider.java │ │ │ ├── ShortArbitraryProvider.java │ │ │ ├── StreamArbitraryProvider.java │ │ │ ├── StringArbitraryProvider.java │ │ │ ├── UseTypeArbitraryProvider.java │ │ │ ├── VoidArbitraryProvider.java │ │ │ └── package-info.java │ │ │ ├── recording │ │ │ ├── TestRun.java │ │ │ ├── TestRunData.java │ │ │ ├── TestRunDatabase.java │ │ │ ├── TestRunRecorder.java │ │ │ └── package-info.java │ │ │ └── support │ │ │ ├── ChooseRandomlyByFrequency.java │ │ │ ├── Combinatorics.java │ │ │ ├── GenericsClassContext.java │ │ │ ├── GenericsSupport.java │ │ │ ├── JqwikAnnotationSupport.java │ │ │ ├── JqwikExceptionSupport.java │ │ │ ├── JqwikKotlinSupport.java │ │ │ ├── JqwikReflectionSupport.java │ │ │ ├── JqwikStreamSupport.java │ │ │ ├── JqwikStringSupport.java │ │ │ ├── LazyServiceLoaderCache.java │ │ │ ├── LruCache.java │ │ │ ├── MathSupport.java │ │ │ ├── MethodParameter.java │ │ │ ├── OverriddenMethodAnnotationSupport.java │ │ │ ├── StreamConcatenation.java │ │ │ ├── TypeResolution.java │ │ │ ├── combinatorics │ │ │ ├── CombinedIterator.java │ │ │ ├── ConcatIterator.java │ │ │ ├── PermutationIterator.java │ │ │ ├── SetIterator.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── types │ │ │ ├── TypeUsageImpl.java │ │ │ ├── TypeUsageToString.java │ │ │ └── package-info.java │ ├── module │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── net.jqwik.api.Arbitraries$ArbitrariesFacade │ │ ├── net.jqwik.api.Arbitrary$ArbitraryFacade │ │ ├── net.jqwik.api.Combinators$CombinatorsFacade │ │ ├── net.jqwik.api.EdgeCases$EdgeCasesFacade │ │ ├── net.jqwik.api.ExhaustiveGenerator$ExhaustiveGeneratorFacade │ │ ├── net.jqwik.api.Functions$FunctionsFacade │ │ ├── net.jqwik.api.JavaBeanReportingFormat$JavaBeanReportingFormatFacade │ │ ├── net.jqwik.api.RandomDistribution$RandomDistributionFacade │ │ ├── net.jqwik.api.RandomGenerator$RandomGeneratorFacade │ │ ├── net.jqwik.api.SampleReportingFormat │ │ ├── net.jqwik.api.Shrinkable$ShrinkableFacade │ │ ├── net.jqwik.api.configurators.ArbitraryConfigurator │ │ ├── net.jqwik.api.domains.DomainContext$DomainContextFacade │ │ ├── net.jqwik.api.facades.ReflectionSupportFacade │ │ ├── net.jqwik.api.facades.ShrinkingSupportFacade │ │ ├── net.jqwik.api.facades.TestingSupportFacade │ │ ├── net.jqwik.api.lifecycle.LifecycleHook │ │ ├── net.jqwik.api.lifecycle.Store$StoreFacade │ │ ├── net.jqwik.api.providers.ArbitraryProvider │ │ ├── net.jqwik.api.providers.TypeUsage$TypeUsageFacade │ │ ├── net.jqwik.api.sessions.JqwikSession$JqwikSessionFacade │ │ ├── net.jqwik.api.state.ActionChain$ActionChainFacade │ │ ├── net.jqwik.api.state.Chain$ChainFacade │ │ ├── net.jqwik.api.statistics.Statistics$StatisticsFacade │ │ └── org.junit.platform.engine.TestEngine │ └── test │ └── java │ ├── examples │ ├── bugs │ │ ├── CombiningCharacterArbitrariesBug.java │ │ ├── ExhaustiveGenerationBug.java │ │ ├── GeneratingHighDoubles.java │ │ ├── Issue519Bug.java │ │ ├── JqwikActionsShrinkToNothing.java │ │ ├── JqwikHeapBust.java │ │ ├── JqwikLogExplosion.java │ │ ├── ListOfConsumersBug.java │ │ ├── MaxEdgeCasesBelowZeroBug.java │ │ ├── PositiveIntegersGenerationBug.java │ │ ├── SampleInGeneratorBug.java │ │ ├── ShrinkingListElementsNotEnough.java │ │ ├── ShrinkingStackOverflow.java │ │ └── StringListGenerationBug.java │ ├── packageWithDisabledTests │ │ └── DisabledTests.java │ ├── packageWithErrors │ │ ├── AbstractContainerForOverloadedExamples.java │ │ ├── ContainerWithOOME.java │ │ ├── ContainerWithOverloadedExamples.java │ │ └── ContainerWithStaticTestMethods.java │ ├── packageWithFailings │ │ ├── Container1.java │ │ ├── Container2.java │ │ ├── ContainerWithFailingConstructor.java │ │ └── ContainerWithStatistics.java │ ├── packageWithInheritance │ │ ├── AbstractContainer.java │ │ ├── ContainerWithInheritance.java │ │ └── InterfaceTests.java │ ├── packageWithNestedContainers │ │ ├── ClassWithContainer.java │ │ ├── TopLevelContainerWithGroups.java │ │ └── TopLevelContainerWithNoGroups.java │ ├── packageWithProperties │ │ ├── AnnotatedPropertiesTests.java │ │ ├── CollectingStatisticsExamples.java │ │ ├── FizzBuzzTests2.java │ │ ├── GeneratorsExamples.java │ │ ├── NumberCoverageExamples.java │ │ ├── PropertiesTriesCounting.java │ │ ├── PropertiesWithAssumptions.java │ │ ├── ShrinkingExamples.java │ │ └── TestsForReporting.java │ ├── packageWithSeveralContainers │ │ ├── ExampleTests.java │ │ ├── MixedTests.java │ │ └── PropertyTests.java │ └── packageWithSingleContainer │ │ ├── ClassWithoutTests.java │ │ └── SimpleExampleTests.java │ ├── experiments │ ├── CompositeActionExperiments.java │ ├── GuidanceExperiments.java │ ├── MarkovChainExperiments.java │ ├── MutatingChainExperiments.java │ ├── PerformanceTests.java │ ├── ProbabilisticExperiments.java │ └── SharedArbitraryExperiments.java │ └── net │ └── jqwik │ ├── ArchitectureTests.java │ ├── OrderedArbitraryForTesting.java │ ├── UseArbitrariesOutsideJqwikTests.java │ ├── api │ ├── ArbitrariesRecursiveTests.java │ ├── ArbitrariesTests.java │ ├── ArbitraryIgnoreExceptionsTests.java │ ├── ArbitraryTestHelper.java │ ├── ArbitraryTests.java │ ├── ArrayArbitraryTests.java │ ├── BuildersTests.java │ ├── CombinatorsTests.java │ ├── DoubleArbitraryTests.java │ ├── ExhaustiveGenerationTests.java │ ├── FlatCombinatorsTests.java │ ├── FloatArbitraryTests.java │ ├── FunctionsTests.java │ ├── GenericGenerationProperties.java │ ├── IteratorArbitraryTests.java │ ├── ListArbitraryTests.java │ ├── MapArbitraryTests.java │ ├── SetArbitraryTests.java │ ├── StreamArbitraryTests.java │ ├── TupleTests.java │ ├── configurators │ │ └── ConfiguratorBaseTests.java │ ├── constraints │ │ ├── AnnotatedParameterTypesProperties.java │ │ ├── ArraysConstraintsProperties.java │ │ ├── CharsProperties.java │ │ ├── NegativeProperties.java │ │ ├── NotBlankProperties.java │ │ ├── PositiveProperties.java │ │ ├── RangeProperties.java │ │ ├── ScaleProperties.java │ │ ├── SizeProperties.java │ │ ├── StringLengthProperties.java │ │ ├── UniqueCharsProperties.java │ │ ├── UniqueElementsProperties.java │ │ ├── UseTypeProperties.java │ │ ├── WhitespaceProperties.java │ │ └── WithNullProperties.java │ ├── domains │ │ ├── ContextIsArbitraryConfigurator.java │ │ ├── ContextIsArbitraryProvider.java │ │ ├── ContextWithDependentProviders.java │ │ ├── ContextWithDomainAnnotation.java │ │ ├── ContextWithInnerConfiguratorClasses.java │ │ ├── ContextWithInnerProviderClasses.java │ │ ├── ContextWithInnerReportingFormatClasses.java │ │ ├── ContextWithProviderMethods.java │ │ ├── DomainContextBaseTests.java │ │ ├── DomainInitializationTests.java │ │ ├── Doubled.java │ │ └── MakeNegative.java │ ├── edgeCases │ │ ├── ArbitrariesEdgeCasesTests.java │ │ ├── ArbitraryEdgeCasesTests.java │ │ ├── EdgeCasesExceedLimitTests.java │ │ ├── EdgeCasesGenerationProperties.java │ │ ├── EdgeCasesTests.java │ │ ├── GenericEdgeCasesProperties.java │ │ └── NumbersEdgeCasesTests.java │ ├── lifecycle │ │ ├── InheritedLifecycleHooksTests.java │ │ ├── PerPropertyTests.java │ │ └── PropertyDefaultsTests.java │ ├── providers │ │ ├── ProgrammaticArbitraryProviderRegistrationTests.java │ │ ├── RegisteredArbitraryProvidersTests.java │ │ └── TypeUsageTests.java │ ├── statistics │ │ ├── HistogramTests.java │ │ └── StatisticsCoverageTests.java │ └── support │ │ ├── HashCodeSupportTests.java │ │ └── LambdaSupportTests.java │ ├── engine │ ├── JqwikIntegrationTests.java │ ├── JqwikPropertiesTests.java │ ├── JqwikUniqueIdBuilder.java │ ├── TestDescriptorBuilder.java │ ├── TestHelper.java │ ├── discovery │ │ ├── ContainerResolverTest.java │ │ ├── DiscoveryTests.java │ │ └── PropertyMethodResolverTests.java │ ├── execution │ │ ├── AfterFailureParametersGeneratorTests.java │ │ ├── CheckedPropertiesExecutionTests.java │ │ ├── CheckedPropertyFactoryTests.java │ │ ├── ContainerExecutionTests.java │ │ ├── ExecutionPipelineTests.java │ │ ├── GenerationInfoTests.java │ │ ├── JqwikExecutorTests.java │ │ ├── MockExecutionTask.java │ │ ├── MockPipeline.java │ │ ├── ParametersGeneratorForTests.java │ │ ├── SimplePropertiesExecutionTests.java │ │ ├── lifecycle │ │ │ ├── AfterContainerHookTests.java │ │ │ ├── AroundContainerHookTests.java │ │ │ ├── AroundPropertyHookTests.java │ │ │ ├── AroundTryHookTests.java │ │ │ ├── AutoCloseableLifecycleTests.java │ │ │ ├── BeforeContainerHookTests.java │ │ │ ├── BeforeTryOnMemberVariableTests.java │ │ │ ├── InvokePropertyMethodHookTests.java │ │ │ ├── LifecycleContextAnnotationsTests.java │ │ │ ├── LifecycleContextToStringTests.java │ │ │ ├── LifecycleMethodsTests.java │ │ │ ├── LifecycleRegistryTests.java │ │ │ ├── PropertyAttributesTests.java │ │ │ ├── ProvidePropertyInstanceHookTests.java │ │ │ ├── RegistrarHookTests.java │ │ │ ├── StoreRepositoryTests.java │ │ │ └── StoreTests.java │ │ └── reporting │ │ │ ├── EnableFootnotesTests.java │ │ │ ├── JavaBeanReportingFormatTests.java │ │ │ ├── LineReporterStub.java │ │ │ ├── ParameterChangesDetectorTests.java │ │ │ ├── ResolveReporterHookTests.java │ │ │ └── SampleReportingTests.java │ ├── matchers │ │ ├── IsClassDescriptorFor.java │ │ ├── IsPropertyDescriptorFor.java │ │ ├── IsPropertyExecutionResultFailure.java │ │ ├── IsTestResultFailure.java │ │ ├── PropertyExecutionResultMatchers.java │ │ ├── TestDescriptorMatchers.java │ │ └── TestExecutionResultMatchers.java │ ├── properties │ │ ├── CheckedPropertyTests.java │ │ ├── DataBasedShrinkablesGeneratorTests.java │ │ ├── ExhaustiveShrinkablesGeneratorTests.java │ │ ├── ForAllSpy.java │ │ ├── GenericPropertyTests.java │ │ ├── PropertyConfigurationBuilder.java │ │ ├── PropertyMethodArbitraryResolverTests.java │ │ ├── PropertyMethodDataResolverTests.java │ │ ├── RandomizedShrinkablesGeneratorTests.java │ │ ├── RangeTests.java │ │ ├── RegisteredArbitraryResolverTests.java │ │ ├── ResolvingParametersInConstructorTests.java │ │ ├── ResolvingParametersInLifecycleMethodsTests.java │ │ ├── ResolvingParametersInTryTests.java │ │ ├── arbitraries │ │ │ ├── DefaultCharacterArbitraryTests.java │ │ │ ├── DefaultStringArbitraryTests.java │ │ │ ├── DefaultTypeArbitraryTests.java │ │ │ ├── TraverseArbitraryTests.java │ │ │ └── randomized │ │ │ │ ├── RandomDistributionProperties.java │ │ │ │ └── RandomGeneratorsTests.java │ │ ├── shrinking │ │ │ ├── ArbitraryShrinkingTests.java │ │ │ ├── BigIntegerShrinkerTests.java │ │ │ ├── ChooseValueShrinkableTests.java │ │ │ ├── CollectShrinkableTests.java │ │ │ ├── CombinatorsShrinkingTests.java │ │ │ ├── CombinedShrinkableTests.java │ │ │ ├── ErrorEquivalenceCheckerTests.java │ │ │ ├── FilteredShrinkableTests.java │ │ │ ├── FlatMappedShrinkableTests.java │ │ │ ├── LazyArbitraryShrinkingTests.java │ │ │ ├── LazyOfArbitraryShrinkingTests.java │ │ │ ├── MappedShrinkableTests.java │ │ │ ├── PropertyShrinkerTests.java │ │ │ ├── ShrinkTowardsTests.java │ │ │ ├── ShrinkableBigDecimalTests.java │ │ │ ├── ShrinkableBigIntegerTests.java │ │ │ ├── ShrinkableListTests.java │ │ │ ├── ShrinkableProperties.java │ │ │ ├── ShrinkableSetTests.java │ │ │ ├── ShrinkableStringTests.java │ │ │ ├── ShrinkableTypesForTest.java │ │ │ ├── ShrinkingDistanceTests.java │ │ │ ├── ShrinkingQualityProperties.java │ │ │ ├── ShrunkSampleRecreatorTests.java │ │ │ └── UnshrinkableTests.java │ │ ├── state │ │ │ ├── ActionChainArbitraryTests.java │ │ │ └── ChainArbitraryTests.java │ │ └── stateful │ │ │ ├── ActionGeneratorTests.java │ │ │ ├── ActionSequenceInvariantTests.java │ │ │ ├── ActionSequenceProperties.java │ │ │ ├── ActionSequenceShrinkingTests.java │ │ │ ├── SequentialActionSequenceTests.java │ │ │ └── ShrinkableActionSequenceTests.java │ ├── statistics │ │ ├── StatisticsCollectionTests.java │ │ ├── StatisticsHookTests.java │ │ └── StatisticsReportingTests.java │ └── support │ │ ├── CombinatoricsTests.java │ │ ├── CombinedIteratorTests.java │ │ ├── GenericsSupportTests.java │ │ ├── JqwikAnnotationSupportTests.java │ │ ├── JqwikReflectionSupportTests.java │ │ └── JqwikStreamSupportTests.java │ └── testing │ └── TestingSupportTests.java ├── experiments ├── Builder.java ├── DataDrivenSpec.java ├── Fixture.java ├── ForAllLifeCycle.java ├── ForEachLifeCycle.java ├── SimpleSpec.java ├── Spec.java ├── SpecPlugin.java ├── SpecWithFixtureClasses.java └── UsePlugIn.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jqwik-images.key ├── kotlin ├── build.gradle └── src │ ├── main │ ├── kotlin │ │ └── net │ │ │ └── jqwik │ │ │ └── kotlin │ │ │ ├── api │ │ │ ├── AnyForSubtypeOfDsl.kt │ │ │ ├── ArbitraryExtensions.kt │ │ │ ├── BuildersExtensions.kt │ │ │ ├── CollectionExtensions.kt │ │ │ ├── CombinatorDsl.kt │ │ │ ├── CombinatorsExtensions.kt │ │ │ ├── IntRangeArbitrary.kt │ │ │ ├── JqwikGlobals.kt │ │ │ ├── KotlinTypesExtensions.kt │ │ │ ├── SequenceArbitrary.kt │ │ │ ├── SizableArbitraryExtensions.kt │ │ │ ├── StringArbitraryExtensions.kt │ │ │ ├── TupleExtensions.kt │ │ │ ├── TypeAliases.kt │ │ │ └── TypeUsageExtensions.kt │ │ │ └── internal │ │ │ ├── DefaultConstructorMarkerProvider.kt │ │ │ ├── IntRangeArbitraryProvider.kt │ │ │ ├── KTypeEnhancer.kt │ │ │ ├── KotlinReflectionSupport.kt │ │ │ ├── KotlinSizeConfigurator.kt │ │ │ ├── KotlinUniqueElementsConfigurator.kt │ │ │ ├── NullabilityEnhancer.kt │ │ │ ├── ObjectAsContainerClassHook.kt │ │ │ ├── PairArbitraryProvider.kt │ │ │ ├── PairReportingFormat.kt │ │ │ ├── ParameterAnnotationEnhancer.kt │ │ │ ├── SequenceArbitraryProvider.kt │ │ │ ├── SuspendedPropertyMethodsHook.kt │ │ │ ├── TripleArbitraryProvider.kt │ │ │ └── TripleReportingFormat.kt │ ├── module │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── net.jqwik.api.SampleReportingFormat │ │ ├── net.jqwik.api.configurators.ArbitraryConfigurator │ │ ├── net.jqwik.api.lifecycle.LifecycleHook │ │ ├── net.jqwik.api.providers.ArbitraryProvider │ │ └── net.jqwik.api.providers.TypeUsage$Enhancer │ └── test │ ├── java │ └── net │ │ └── jqwik │ │ └── kotlin │ │ └── java │ │ └── JavaProperty.java │ └── kotlin │ └── net │ └── jqwik │ └── kotlin │ ├── AnyForSubtypeOfTests.kt │ ├── ArbitraryExtensionsTests.kt │ ├── BuildersExtensionsTests.kt │ ├── CollectionExtensionsTests.kt │ ├── CombinatorDslTests.kt │ ├── CombinatorsExtensionsTests.kt │ ├── ConvenienceFunctionsTests.kt │ ├── DataClassAsContainerTests.kt │ ├── IntRangeArbitraryTests.kt │ ├── InternalModifierTests.kt │ ├── JqwikTupleTests.kt │ ├── KotlinFunctionsTests.kt │ ├── KotlinPairTests.kt │ ├── KotlinSequenceTests.kt │ ├── KotlinTripleTests.kt │ ├── KotlinTypesCompatibilityTests.kt │ ├── KotlinTypesExtensionsTests.kt │ ├── NullabilityTests.kt │ ├── ParameterAnnotationsTests.kt │ ├── PropertyMethodContextTests.kt │ ├── ReflectionSupportTests.kt │ ├── ReportingFormatsTests.kt │ ├── SingletonTests.kt │ ├── SizableArbitraryExtensionsTests.kt │ ├── StringArbitraryExtensionsTests.kt │ ├── SuspendedPropertiesTests.kt │ ├── TypeUsageExtensionsTests.kt │ └── UseTypeWithDataAndValueClassesTests.kt ├── settings.gradle ├── test-modular-api ├── build.gradle └── src │ └── test │ ├── java │ ├── module-info.java │ └── test │ │ └── modular │ │ └── api │ │ └── ModularTests.java │ └── resources │ └── junit-platform.properties ├── testing ├── build.gradle └── src │ └── main │ ├── java │ └── net │ │ └── jqwik │ │ └── testing │ │ ├── CheckReporting.java │ │ ├── ExpectFailure.java │ │ ├── ReportMemoryHook.java │ │ ├── ShrinkToChecker.java │ │ ├── ShrinkingSupport.java │ │ ├── SuppressLogging.java │ │ ├── TestingFalsifier.java │ │ └── TestingSupport.java │ ├── module │ └── module-info.java │ └── resources │ ├── archunit.properties │ ├── junit-platform.properties │ └── log4j2-test.xml ├── time ├── build.gradle └── src │ ├── main │ ├── java │ │ └── net │ │ │ └── jqwik │ │ │ └── time │ │ │ ├── api │ │ │ ├── DateTimes.java │ │ │ ├── Dates.java │ │ │ ├── Times.java │ │ │ ├── arbitraries │ │ │ │ ├── CalendarArbitrary.java │ │ │ │ ├── DateArbitrary.java │ │ │ │ ├── DurationArbitrary.java │ │ │ │ ├── InstantArbitrary.java │ │ │ │ ├── LocalDateArbitrary.java │ │ │ │ ├── LocalDateTimeArbitrary.java │ │ │ │ ├── LocalTimeArbitrary.java │ │ │ │ ├── MonthDayArbitrary.java │ │ │ │ ├── OffsetDateTimeArbitrary.java │ │ │ │ ├── OffsetTimeArbitrary.java │ │ │ │ ├── PeriodArbitrary.java │ │ │ │ ├── YearArbitrary.java │ │ │ │ ├── YearMonthArbitrary.java │ │ │ │ ├── ZoneOffsetArbitrary.java │ │ │ │ ├── ZonedDateTimeArbitrary.java │ │ │ │ └── package-info.java │ │ │ ├── constraints │ │ │ │ ├── DateRange.java │ │ │ │ ├── DateTimeRange.java │ │ │ │ ├── DayOfMonthRange.java │ │ │ │ ├── DayOfWeekRange.java │ │ │ │ ├── DurationRange.java │ │ │ │ ├── HourRange.java │ │ │ │ ├── InstantRange.java │ │ │ │ ├── MinuteRange.java │ │ │ │ ├── MonthDayRange.java │ │ │ │ ├── MonthRange.java │ │ │ │ ├── OffsetRange.java │ │ │ │ ├── PeriodRange.java │ │ │ │ ├── Precision.java │ │ │ │ ├── SecondRange.java │ │ │ │ ├── TimeRange.java │ │ │ │ ├── YearMonthRange.java │ │ │ │ ├── YearRange.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ │ └── internal │ │ │ └── properties │ │ │ ├── arbitraries │ │ │ ├── DefaultCalendarArbitrary.java │ │ │ ├── DefaultDateArbitrary.java │ │ │ ├── DefaultDurationArbitrary.java │ │ │ ├── DefaultInstantArbitrary.java │ │ │ ├── DefaultLocalDateArbitrary.java │ │ │ ├── DefaultLocalDateTimeArbitrary.java │ │ │ ├── DefaultLocalTimeArbitrary.java │ │ │ ├── DefaultMonthDayArbitrary.java │ │ │ ├── DefaultOffsetDateTimeArbitrary.java │ │ │ ├── DefaultOffsetTimeArbitrary.java │ │ │ ├── DefaultPeriodArbitrary.java │ │ │ ├── DefaultYearArbitrary.java │ │ │ ├── DefaultYearMonthArbitrary.java │ │ │ ├── DefaultZoneOffsetArbitrary.java │ │ │ ├── DefaultZonedDateTimeArbitrary.java │ │ │ └── valueRanges │ │ │ │ ├── AllowedDayOfWeeks.java │ │ │ │ ├── AllowedMonths.java │ │ │ │ ├── AllowedUnits.java │ │ │ │ ├── Between.java │ │ │ │ ├── DayOfMonthBetween.java │ │ │ │ ├── DurationBetween.java │ │ │ │ ├── HourBetween.java │ │ │ │ ├── LocalDateBetween.java │ │ │ │ ├── LocalDateTimeBetween.java │ │ │ │ ├── LocalTimeBetween.java │ │ │ │ ├── MinuteBetween.java │ │ │ │ ├── MonthBetween.java │ │ │ │ ├── OfPrecision.java │ │ │ │ ├── PeriodBetween.java │ │ │ │ ├── SecondBetween.java │ │ │ │ ├── YearBetween.java │ │ │ │ ├── YearMonthBetween.java │ │ │ │ └── ZoneOffsetBetween.java │ │ │ ├── configurators │ │ │ ├── DateRangeConfigurator.java │ │ │ ├── DateTimeRangeConfigurator.java │ │ │ ├── DayOfMonthRangeConfigurator.java │ │ │ ├── DayOfWeekRangeConfigurator.java │ │ │ ├── DurationRangeConfigurator.java │ │ │ ├── HourRangeConfigurator.java │ │ │ ├── InstantConfigurator.java │ │ │ ├── MinuteRangeConfigurator.java │ │ │ ├── MonthDayRangeConfigurator.java │ │ │ ├── MonthRangeConfigurator.java │ │ │ ├── OffsetRangeConfigurator.java │ │ │ ├── PeriodRangeConfigurator.java │ │ │ ├── PrecisionConfigurator.java │ │ │ ├── SecondRangeConfigurator.java │ │ │ ├── TimeRangeConfigurator.java │ │ │ ├── YearMonthRangeConfigurator.java │ │ │ └── YearRangeConfigurator.java │ │ │ └── providers │ │ │ ├── DateTimeArbitraryProvider.java │ │ │ ├── DurationArbitraryProvider.java │ │ │ ├── InstantArbitraryProvider.java │ │ │ ├── LocalDateArbitraryProvider.java │ │ │ ├── MonthDayArbitraryProvider.java │ │ │ ├── OffsetDateTimeArbitraryProvider.java │ │ │ ├── OffsetTimeArbitraryProvider.java │ │ │ ├── PeriodArbitraryProvider.java │ │ │ ├── TimeArbitraryProvider.java │ │ │ ├── TimeZoneArbitraryProvider.java │ │ │ ├── YearArbitraryProvider.java │ │ │ ├── YearMonthArbitraryProvider.java │ │ │ ├── ZoneIdArbitraryProvider.java │ │ │ ├── ZoneOffsetsArbitraryProvider.java │ │ │ └── ZonedDateTimeArbitraryProvider.java │ ├── module │ │ └── module-info.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── net.jqwik.api.configurators.ArbitraryConfigurator │ │ └── net.jqwik.api.providers.ArbitraryProvider │ └── test │ └── java │ └── net │ └── jqwik │ └── time │ └── api │ ├── dateTimes │ ├── instant │ │ ├── DefaultGenerationTests.java │ │ ├── InstantMethodsTests.java │ │ ├── InvalidConfigurationTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ └── constraint │ │ │ ├── ConstraintsTests.java │ │ │ ├── InvalidConfigurationsTests.java │ │ │ ├── InvalidUseOfContraintsTests.java │ │ │ └── ValidTypesWithOwnArbitrariesTests.java │ ├── localDateTime │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── EqualDistributionTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ ├── constraint │ │ │ ├── ConstraintsTests.java │ │ │ ├── InvalidConfigurationsTests.java │ │ │ ├── InvalidUseOfContraintsTests.java │ │ │ └── ValidTypesWithOwnArbitrariesTests.java │ │ ├── dateTimeMethods │ │ │ ├── DateTests.java │ │ │ ├── DateTimeTests.java │ │ │ └── TimeTests.java │ │ ├── exhaustiveGeneration │ │ │ ├── BetweenTests.java │ │ │ ├── PrecisionImplicitlyTests.java │ │ │ └── PrecisionTests.java │ │ └── invalidConfiguration │ │ │ ├── InvalidCombinationTests.java │ │ │ ├── InvalidValueTests.java │ │ │ └── PrecisionTests.java │ ├── offsetDateTime │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── OffsetDateTimeMethodsTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ └── constraint │ │ │ ├── ConstraintsTests.java │ │ │ └── ValidTypesWithOwnArbitrariesTests.java │ └── zonedDateTime │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ ├── ZonedDateTimeMethodsTests.java │ │ └── constraint │ │ ├── ConstraintsTests.java │ │ └── ValidTypesWithOwnArbitrariesTests.java │ ├── dates │ ├── calendar │ │ ├── CalendarMethodsTests.java │ │ ├── ConstraintTests.java │ │ ├── EdgeCasesTests.java │ │ ├── EqualDistributionTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── InvalidConfigurationTests.java │ │ ├── ShrinkingTests.java │ │ └── SimpleArbitrariesTests.java │ ├── date │ │ ├── ConstraintTests.java │ │ ├── DateMethodsTests.java │ │ ├── EdgeCasesTests.java │ │ ├── EqualDistributionTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── InvalidConfigurationTests.java │ │ ├── ShrinkingTests.java │ │ └── SimpleArbitrariesTests.java │ ├── dayOfMonth │ │ └── ConstraintTests.java │ ├── localDate │ │ ├── ConstraintTests.java │ │ ├── DateMethodTests.java │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── EqualDistributionTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── InvalidConfigurationTests.java │ │ ├── ShrinkingTests.java │ │ └── SimpleArbitrariesTests.java │ ├── monthDay │ │ ├── ConstraintTests.java │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── MonthDayMethodsTests.java │ │ ├── ShrinkingTests.java │ │ └── SimpleArbitrariesTests.java │ ├── period │ │ ├── ConstraintTests.java │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── EqualDistributionTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── PeriodMethodsTests.java │ │ ├── ShrinkingTests.java │ │ └── SimpleArbitrariesTests.java │ ├── year │ │ ├── ConstraintTests.java │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ └── YearMethodsTests.java │ └── yearMonth │ │ ├── ConstraintTests.java │ │ ├── DefaultGenerationTests.java │ │ ├── EdgeCasesTests.java │ │ ├── ExhaustiveGenerationTests.java │ │ ├── InvalidConfigurationTests.java │ │ ├── ShrinkingTests.java │ │ ├── SimpleArbitrariesTests.java │ │ └── YearMonthMethodsTests.java │ ├── testingSupport │ ├── ForCalendar.java │ ├── ForDate.java │ └── ForDuration.java │ └── times │ ├── duration │ ├── ConstraintTests.java │ ├── DefaultGenerationTests.java │ ├── DurationMethodsTests.java │ ├── EdgeCasesTests.java │ ├── EqualDistributionTests.java │ ├── InvalidConfigurationTests.java │ ├── ShrinkingTests.java │ ├── SimpleArbitrariesTests.java │ └── exhaustiveGeneration │ │ └── precision │ │ ├── HoursTests.java │ │ ├── MicrosTests.java │ │ ├── MillisTests.java │ │ ├── MinutesTests.java │ │ ├── NanosTests.java │ │ ├── SecondsTests.java │ │ └── precisionImplicitly │ │ ├── MicrosTests.java │ │ ├── MillisTests.java │ │ ├── NanosTests.java │ │ └── SecondsTests.java │ ├── localTime │ ├── DefaultGenerationTests.java │ ├── EdgeCasesTests.java │ ├── EqualDistributionTests.java │ ├── InvalidConfigurationTests.java │ ├── ShrinkingTests.java │ ├── SimpleArbitrariesTests.java │ ├── constraint │ │ ├── ConstraintsTests.java │ │ ├── InvalidConfigurationsTests.java │ │ ├── InvalidUseOfConstraintsTests.java │ │ └── ValidTypesWithOwnArbitrariesTests.java │ ├── exhaustiveGeneration │ │ ├── BetweenTests.java │ │ ├── PrecisionImplicitlyTests.java │ │ └── PrecisionTests.java │ └── timeMethods │ │ ├── HourTests.java │ │ ├── MinuteTests.java │ │ ├── PrecisionTests.java │ │ ├── SecondTests.java │ │ └── TimeTests.java │ ├── offsetTime │ ├── DefaultGenerationTests.java │ ├── EdgeCasesTests.java │ ├── EqualDistributionTests.java │ ├── InvalidConfigurationTests.java │ ├── ShrinkingTests.java │ ├── SimpleArbitrariesTests.java │ ├── constraint │ │ ├── ConstraintsTests.java │ │ ├── InvalidConfigurationsTests.java │ │ └── ValidTypesWithOwnArbitrariesTests.java │ ├── exhaustiveGeneration │ │ ├── OffsetTimeTests.java │ │ ├── PrecisionImplicitlyTests.java │ │ └── PrecisionTests.java │ └── timeMethods │ │ ├── HourTests.java │ │ ├── MinuteTests.java │ │ ├── OffsetTests.java │ │ ├── PrecisionTests.java │ │ ├── SecondTests.java │ │ └── TimeTests.java │ └── zoneOffset │ ├── ConstraintTests.java │ ├── DefaultGenerationTests.java │ ├── EdgeCasesTests.java │ ├── EqualDistributionTests.java │ ├── ExhaustiveGenerationTests.java │ ├── InvalidConfigurationTests.java │ ├── OffsetMethodsTests.java │ ├── ShrinkingTests.java │ └── SimpleArbitrariesTests.java └── web ├── build.gradle └── src ├── main ├── java │ └── net │ │ └── jqwik │ │ └── web │ │ ├── DefaultEmailArbitrary.java │ │ ├── DefaultWebDomainArbitrary.java │ │ ├── EmailArbitraryProvider.java │ │ ├── WebDomainArbitraryProvider.java │ │ └── api │ │ ├── Email.java │ │ ├── EmailArbitrary.java │ │ ├── Web.java │ │ ├── WebDomain.java │ │ └── package-info.java ├── module │ └── module-info.java └── resources │ └── META-INF │ └── services │ └── net.jqwik.api.providers.ArbitraryProvider └── test └── java └── net └── jqwik └── web └── api ├── EmailProperties.java ├── EmailsTests.java ├── WebDomainTests.java └── WebTestingSupport.java /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: jqwik-team 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.MD: -------------------------------------------------------------------------------- 1 | ## Testing Problem 2 | 3 | _Formulate the testing problem that is currently not solvable by _jqwik_ 4 | or not solvable in a simple enough way._ 5 | 6 | ## Suggested Solution 7 | 8 | _Sketch the solution you imagine or just note down that you have no specific solution in mind._ 9 | 10 | ## Discussion 11 | 12 | _Discuss advantages and disadvantages of your solution. Compare it to alternative 13 | suggestions if there are any._ 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | _Formulate the problem / feature your pull request is aiming at_ 4 | 5 | ### Details 6 | 7 | _Give any necessary details about your code that is not obvious from the code itself._ 8 | 9 | _List open issues and remaining problems with your solution._ 10 | 11 | --- 12 | 13 | I hereby agree to the terms of the [jqwik Contributor Agreement](https://github.com/jqwik-team/jqwik/blob/master/CONTRIBUTING.md#jqwik-contributor-agreement). 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Configure GitHub Dependabot 2 | # Please see the documentation for all configuration options: 3 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 4 | 5 | version: 2 6 | updates: 7 | - package-ecosystem: "gradle" 8 | directory: "/" 9 | schedule: 10 | interval: "weekly" 11 | - package-ecosystem: "github-actions" 12 | directory: "/" 13 | schedule: 14 | interval: "weekly" 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Jqwik 2 | .jqwik-* 3 | 4 | # Gradle 5 | .gradle 6 | build/ 7 | 8 | # Ignore Gradle GUI config 9 | gradle-app.setting 10 | 11 | # Eclipse 12 | .classpath 13 | .settings/ 14 | .project 15 | bin/ 16 | 17 | # IntelliJ 18 | *.iml 19 | *.ipr 20 | *.iws 21 | *.uml 22 | .shelf 23 | .idea/** 24 | !.idea/icon.png 25 | out/ 26 | 27 | # Misc 28 | *.log 29 | *.graphml 30 | *.salive 31 | 32 | # Mac 33 | .DS_Store 34 | -------------------------------------------------------------------------------- /.idea/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jqwik-team/jqwik/4a2db008aaca36448ccd2b980cc86861a33b985c/.idea/icon.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.jqwik/jqwik/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.jqwik/jqwik) 2 | [![Javadocs](http://javadoc.io/badge/net.jqwik/jqwik-api.svg)](https://jqwik.net/docs/current/javadoc/index.html) 3 | [![CI Status](https://github.com/jqwik-team/jqwik/workflows/CI/badge.svg?branch=main)](https://github.com/jqwik-team/jqwik/actions) 4 | 5 | # jqwik 6 | 7 | An alternative 8 | [test engine for the JUnit 5 platform](https://junit.org/junit5/docs/current/user-guide/#launcher-api-engines-custom) 9 | that focuses on Property-Based Testing. 10 | 11 | 12 | ## See the [jqwik website](http://jqwik.net) for further details and documentation. 13 | 14 | 15 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/Data.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Used to annotate methods that can provide data points for property methods. 11 | * Those methods must return an instance of {@linkplain Iterable}. 12 | * 13 | * {@code value} is used as reference name. If it is not specified, the method's name is used instead. 14 | */ 15 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | @API(status = MAINTAINED, since = "1.0") 19 | public @interface Data { 20 | String value() default ""; 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/Disabled.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Use {@code @Disabled("reason to disable")} to disable test container or test method 11 | * during normal test execution. 12 | */ 13 | @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE, ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Documented 16 | @API(status = MAINTAINED, since = "1.0") 17 | public @interface Disabled { 18 | 19 | /** 20 | * The reason this annotated test container or test method is disabled. 21 | * 22 | * @return reason for disabling test or test container 23 | */ 24 | String value() default ""; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/FromData.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Used to annotate property methods. 11 | * 12 | * Only works on methods annotated with {@code @Property} 13 | * 14 | * {@code value} is used as reference name to a method annotated with {@code @Data}. 15 | * 16 | * @see Property 17 | * @see Data 18 | */ 19 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) 20 | @Retention(RetentionPolicy.RUNTIME) 21 | @Documented 22 | @API(status = MAINTAINED, since = "1.0") 23 | public @interface FromData { 24 | String value(); 25 | } 26 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/Group.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | import org.junit.platform.commons.annotation.Testable; 7 | 8 | import static org.apiguardian.api.API.Status.*; 9 | 10 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE }) 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Documented 13 | @Testable 14 | @API(status = STABLE, since = "1.0") 15 | public @interface Group { 16 | } 17 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/JqwikException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import static org.apiguardian.api.API.Status.*; 6 | 7 | /** 8 | * Base exception for exceptions that are thrown during the discovery phase 9 | * and during setup of properties before they are actually run. 10 | * 11 | * @see CannotFindArbitraryException 12 | * @see TooManyFilterMissesException 13 | */ 14 | @API(status = STABLE, since = "1.0") 15 | public class JqwikException extends RuntimeException { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public JqwikException(String message) { 20 | super(message); 21 | } 22 | 23 | public JqwikException(String message, Throwable cause) { 24 | super(message, cause); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/Label.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | import org.junit.platform.commons.annotation.*; 7 | 8 | import static org.apiguardian.api.API.Status.*; 9 | 10 | /** 11 | * Use {@code @Label("a descriptive name")} to give test classes, groups and methods 12 | * a more readable label (aka display name). 13 | * 14 | * @see Property 15 | * @see Group 16 | */ 17 | @Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | @Testable 21 | @API(status = STABLE, since = "1.0") 22 | public @interface Label { 23 | String value(); 24 | } 25 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/Report.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Use {@code @Report} to specify what additional things should be reported 11 | * when running a property. 12 | * 13 | * @see Property 14 | */ 15 | @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | @API(status = MAINTAINED, since = "1.0") 19 | public @interface Report { 20 | Reporting[] value(); 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/TagList.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | @Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | @Inherited 13 | @API(status = STABLE, since = "1.0") 14 | public @interface TagList { 15 | Tag[] value(); 16 | } 17 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/TooManyFilterMissesException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import static org.apiguardian.api.API.Status.*; 6 | 7 | @API(status = MAINTAINED, since = "1.0") 8 | public class TooManyFilterMissesException extends JqwikException { 9 | public TooManyFilterMissesException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/arbitraries/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.arbitraries; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/configurators/ArbitraryConfigurationException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.configurators; 2 | 3 | import net.jqwik.api.*; 4 | 5 | import java.lang.reflect.*; 6 | 7 | import org.apiguardian.api.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | @API(status = MAINTAINED, since = "1.0") 12 | public class ArbitraryConfigurationException extends JqwikException { 13 | ArbitraryConfigurationException(Method configurationMethod) { 14 | super(String.format("Configuration method <%s> must return object of type Arbitrary or null", configurationMethod.toString())); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/configurators/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.configurators; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/CharRangeList.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | @API(status = MAINTAINED, since = "1.0") 13 | public @interface CharRangeList { 14 | CharRange[] value(); 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/CharsList.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | @API(status = MAINTAINED, since = "1.0") 13 | public @interface CharsList { 14 | Chars[] value(); 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/Negative.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the range of a generated number to be less than 0. 11 | * 12 | * Applies to numeric parameters which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | * @see Positive 16 | */ 17 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | @API(status = MAINTAINED, since = "1.0") 21 | public @interface Negative { 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/NotBlank.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain a string to never be blank, i.e. not empty and not just whitespace. 11 | * 12 | * Applies to String parameters which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | * @see NotEmpty 16 | */ 17 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | @API(status = MAINTAINED, since = "1.5.0") 21 | public @interface NotBlank { 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/Positive.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the range of a generated number to be greater than 0. 11 | * 12 | * Applies to numeric parameters which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | * @see Negative 16 | */ 17 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | @API(status = MAINTAINED, since = "1.0") 21 | public @interface Positive { 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/Size.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the size of generated "sizable" types. 11 | * 12 | * Applies to List, Set, Stream, and arrays which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | */ 16 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | @API(status = MAINTAINED, since = "1.0") 20 | public @interface Size { 21 | int min() default 0; 22 | 23 | int max() default 0; 24 | 25 | int value() default 0; 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/StringLength.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the length of generated Strings. 11 | * 12 | * Applies to String parameters which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | */ 16 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | @API(status = MAINTAINED, since = "1.0") 20 | public @interface StringLength { 21 | int value() default 0; 22 | 23 | int min() default 0; 24 | 25 | int max() default 0; 26 | } 27 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/UniqueChars.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Add a uniqueness constraint to a String parameter, i.e., 11 | * there won't be any duplicate characters in a generated String. 12 | * 13 | * @see net.jqwik.api.ForAll 14 | */ 15 | @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Documented 18 | @API(status = EXPERIMENTAL, since = "1.8.0") 19 | public @interface UniqueChars { 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/constraints/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.constraints; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/domains/DomainList.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.domains; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | @Target({ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | @Inherited 13 | @API(status = MAINTAINED, since = "1.2.0") 14 | public @interface DomainList { 15 | Domain[] value(); 16 | } 17 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/domains/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.domains; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/facades/TestingSupportFacade.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.facades; 2 | 3 | import java.util.*; 4 | import java.util.function.*; 5 | 6 | import net.jqwik.api.*; 7 | 8 | import org.jspecify.annotations.*; 9 | 10 | public abstract class TestingSupportFacade { 11 | 12 | public static final TestingSupportFacade implementation; 13 | 14 | static { 15 | implementation = FacadeLoader.load(TestingSupportFacade.class); 16 | } 17 | 18 | public abstract Shrinkable generateUntil(RandomGenerator generator, Random random, Function condition); 19 | 20 | public abstract String singleLineReport(Object any); 21 | 22 | public abstract List multiLineReport(Object any); 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/facades/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * This package contains interfaces that are implemented by engine-module 3 | * and also used in other modules, e.g. testing. 4 | * They are not supposed to be used from outside jqwik 5 | */ 6 | 7 | //@API(status = API.Status.INTERNAL) // Currently not allowed by api-guardian 8 | @NullMarked 9 | package net.jqwik.api.facades; 10 | 11 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/footnotes/EnableFootnotes.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.footnotes; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import net.jqwik.api.lifecycle.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | /** 12 | * Use this annotation to enable footnote support. 13 | * Can be applied to container classes and property methods. 14 | * 15 | * @see Footnotes 16 | */ 17 | @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.TYPE}) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @AddLifecycleHook(FootnotesHook.class) 20 | @API(status = MAINTAINED, since = "1.5.5") 21 | public @interface EnableFootnotes { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/footnotes/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.footnotes; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/AfterExample.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * This is an alias of {@linkplain AfterProperty} 11 | * 12 | * @see BeforeExample 13 | * @see AfterProperty 14 | */ 15 | @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @AfterProperty 18 | @API(status = MAINTAINED, since = "1.4.0") 19 | public @interface AfterExample { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/BeforeExample.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * This is an alias of {@linkplain BeforeProperty} 11 | * 12 | * @see AfterExample 13 | * @see BeforeProperty 14 | */ 15 | @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @BeforeProperty 18 | @API(status = MAINTAINED, since = "1.4.0") 19 | public @interface BeforeExample { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/CannotFindStoreException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Experimental feature. Not ready for public usage yet. 11 | */ 12 | @API(status = MAINTAINED, since = "1.2.3") 13 | public class CannotFindStoreException extends JqwikException { 14 | public CannotFindStoreException(Object identifier, String retrieverId) { 15 | super(createMessage(identifier, retrieverId)); 16 | } 17 | 18 | private static String createMessage(Object identifier, String retrieverId) { 19 | return String.format( 20 | "Cannot find store with identifier [%s] for [%s]", 21 | identifier, 22 | retrieverId 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/ContainerLifecycleContext.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import static org.apiguardian.api.API.Status.*; 6 | 7 | /** 8 | * The context of a test container (a container class or the whole jqwik suite). 9 | */ 10 | @API(status = MAINTAINED, since = "1.4.0") 11 | public interface ContainerLifecycleContext extends LifecycleContext { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/LifecycleHooks.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Experimental feature. Not ready for public usage yet. 11 | */ 12 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.TYPE }) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Inherited 15 | @API(status = MAINTAINED, since = "1.4.0") 16 | public @interface LifecycleHooks { 17 | AddLifecycleHook[] value(); 18 | } 19 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/ParameterResolutionContext.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.*; 5 | 6 | import org.apiguardian.api.*; 7 | 8 | import net.jqwik.api.*; 9 | import net.jqwik.api.providers.*; 10 | 11 | import static org.apiguardian.api.API.Status.*; 12 | 13 | /** 14 | * Experimental feature. Not ready for public usage yet. 15 | */ 16 | @API(status = MAINTAINED, since = "1.4.0") 17 | public interface ParameterResolutionContext { 18 | 19 | Parameter parameter(); 20 | 21 | TypeUsage typeUsage(); 22 | 23 | int index(); 24 | 25 | @API(status = MAINTAINED, since = "1.5.5") 26 | Optional optionalMethod(); 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/ShrunkFalsifiedSample.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * A shrunk falsified sample is a {@linkplain FalsifiedSample} that results 11 | * from shrinking. 12 | * 13 | * @see PropertyExecutionResult#originalSample() 14 | */ 15 | @API(status = EXPERIMENTAL, since = "1.3.5") 16 | public interface ShrunkFalsifiedSample extends FalsifiedSample { 17 | 18 | /** 19 | * @return number of steps needed to shrink from original sample to this one 20 | */ 21 | int countShrinkingSteps(); 22 | } 23 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/TryExecutor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import java.util.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import net.jqwik.api.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | /** 12 | * Experimental feature. Not ready for public usage yet. 13 | */ 14 | @API(status = MAINTAINED, since = "1.4.0") 15 | public interface TryExecutor { 16 | 17 | TryExecutionResult execute(List parameters); 18 | } 19 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/TryLifecycleContext.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.lifecycle; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import static org.apiguardian.api.API.Status.*; 6 | 7 | /** 8 | * The context information of a single try of a property. 9 | */ 10 | @API(status = MAINTAINED, since = "1.4.0") 11 | public interface TryLifecycleContext extends MethodLifecycleContext { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/lifecycle/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.lifecycle; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/providers/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.providers; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/sessions/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.sessions; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/state/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.state; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/stateful/ActionSequenceArbitrary.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.stateful; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import org.jspecify.annotations.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | @API(status = MAINTAINED, since = "1.0") 12 | public interface ActionSequenceArbitrary extends Arbitrary> { 13 | 14 | /** 15 | * Set the intended number of steps of this sequence. 16 | */ 17 | ActionSequenceArbitrary ofSize(int size); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/stateful/Invariant.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.stateful; 2 | 3 | import org.apiguardian.api.*; 4 | import org.jspecify.annotations.*; 5 | 6 | import static org.apiguardian.api.API.Status.*; 7 | 8 | @FunctionalInterface 9 | @API(status = MAINTAINED, since = "1.0") 10 | public interface Invariant { 11 | 12 | void check(T model); 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/stateful/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.stateful; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/statistics/StatisticsReportList.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.statistics; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | @API(status = MAINTAINED, since = "1.5.1") 13 | public @interface StatisticsReportList { 14 | StatisticsReport[] value(); 15 | } 16 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/statistics/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.api.statistics; 3 | 4 | import org.jspecify.annotations.*; 5 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/support/CollectorsSupport.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.support; 2 | 3 | import java.util.*; 4 | import java.util.stream.*; 5 | 6 | import org.apiguardian.api.*; 7 | import org.jspecify.annotations.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | /** 12 | * Provide implementation for stream to collect to LinkedHashSet in order to preserve order 13 | * and to make random-based generation deterministic 14 | */ 15 | @API(status = INTERNAL) 16 | public class CollectorsSupport { 17 | 18 | private CollectorsSupport() {} 19 | 20 | public static Collector> toLinkedHashSet() { 21 | return Collectors.toCollection(LinkedHashSet::new); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/support/ExceptionSupport.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.support; 2 | 3 | import org.apiguardian.api.*; 4 | 5 | @API(status = API.Status.INTERNAL) 6 | public class ExceptionSupport { 7 | 8 | @SuppressWarnings("unchecked") 9 | private static void throwAs(Throwable t) throws T { 10 | throw (T) t; 11 | } 12 | 13 | // TODO: Remove duplication with JqwikExceptionSupport (in engine module) 14 | public static void rethrowIfBlacklisted(Throwable exception) { 15 | if (exception instanceof OutOfMemoryError) { 16 | ExceptionSupport.throwAs(exception); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /api/src/main/java/net/jqwik/api/support/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | @API(status = INTERNAL) 3 | package net.jqwik.api.support; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import org.jspecify.annotations.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; -------------------------------------------------------------------------------- /base/src/main/module/module-info.java: -------------------------------------------------------------------------------- 1 | module net.jqwik { 2 | requires transitive net.jqwik.api; 3 | requires transitive net.jqwik.engine; 4 | requires transitive net.jqwik.time; 5 | requires transitive net.jqwik.web; 6 | } 7 | -------------------------------------------------------------------------------- /buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | // Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. 7 | id 'groovy-gradle-plugin' 8 | } 9 | 10 | repositories { 11 | // Use the plugin portal to apply community plugins in convention plugins. 12 | gradlePluginPortal() 13 | } 14 | 15 | dependencies { 16 | implementation 'com.github.vlsi.gradle-extensions:com.github.vlsi.gradle-extensions.gradle.plugin:1.90' 17 | } 18 | -------------------------------------------------------------------------------- /buildSrc/src/main/groovy/jqwik.module-configuration.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.beryx.jar' 3 | } 4 | 5 | moduleConfig { 6 | moduleInfoPath = 'src/main/module/module-info.java' // don't confuse IDEs 7 | version = "${jqwikVersion}" 8 | neverCompileModuleInfo = true 9 | } 10 | -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | # jqwik Documentation Module 2 | 3 | ## Requirements (for Mac) 4 | 5 | - doctoc: 6 | `npm install -g doctoc` 7 | 8 | ## Generate 9 | 10 | ```bash 11 | ./gradlew documentation:generateDocumentation 12 | ``` 13 | 14 | 15 | ## Update 16 | 17 | 0. Generate documentation. Mind jqwik version in file `/dependencies.gradle` 18 | 1. Move contents of folder `/documentation/build/docs-XXX` to `/docs/` 19 | - If this is not a snapshot: 20 | - Copy `user-guide.md` to `/docs/current` 21 | - Update "Latest Release: " in `/docs/_layout/default.html` 22 | 3. Push project `jqwik.net` to its GitHub repository, which will trigger the documentation generation action -------------------------------------------------------------------------------- /documentation/src/docs/include/testing-module.md: -------------------------------------------------------------------------------- 1 | This module's artefact name is `jqwik-testing`. It provides a few helpful methods 2 | and classes for generator writers to test their generators - including 3 | edge cases and shrinking. 4 | 5 | This module is _not_ in jqwik's default dependencies. It's usually added as a 6 | test-implementation dependency. 7 | 8 | -------------------------------------------------------------------------------- /documentation/src/docs/index.template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | jqwik Javadoc 5 | 6 | 7 | 8 |

Redirect to latest version

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/MakeGradleHappyTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class MakeGradleHappyTests { 6 | 7 | @Example 8 | void makeGradleHappy() { 9 | // This test is only here to get rid of a Gradle warning 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/ExampleBasedTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import org.assertj.core.data.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | class ExampleBasedTests { 10 | 11 | @Example 12 | void squareRootOf16is4() { 13 | assertThat(Math.sqrt(16)).isCloseTo(4.0, Offset.offset(0.01)); 14 | } 15 | 16 | @Example 17 | boolean add1plu3is4() { 18 | return (1 + 3) == 4; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/FluentConfigurationExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | import java.util.*; 6 | 7 | class FluentConfigurationExamples { 8 | 9 | @Provide 10 | Arbitrary alphaNumericStringsWithMinLength5() { 11 | return Arbitraries.strings().ofMinLength(5).alpha().numeric(); 12 | } 13 | 14 | @Provide 15 | Arbitrary> fixedSizedListOfPositiveIntegers() { 16 | return Arbitraries.integers().greaterOrEqual(0).list().ofSize(17); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/GermanText.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import net.jqwik.api.constraints.*; 6 | 7 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @NumericChars 10 | @AlphaChars 11 | @Chars({'ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü', 'ß'}) 12 | @Chars({' ', '.', ',', ';', '?', '!'}) 13 | @StringLength(min = 10, max = 100) 14 | public @interface GermanText { 15 | } 16 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/NamingExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | @Label("Naming") 6 | class NamingExamples { 7 | 8 | @Property 9 | @Label("a property") 10 | void aPropertyWithALabel() { } 11 | 12 | @Group 13 | @Label("A Group") 14 | class GroupWithLabel { 15 | @Example 16 | @Label("an example äÄöÖüÜ") 17 | void anExampleWithALabel() { } 18 | } 19 | 20 | @Group 21 | class Group_with_spaces { 22 | @Example 23 | void example_with_spaces() { } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/PropertyBasedTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | import org.assertj.core.api.*; 5 | 6 | class PropertyBasedTests { 7 | 8 | @Property 9 | boolean absoluteValueOfAllNumbersIsPositive(@ForAll int anInteger) { 10 | return Math.abs(anInteger) >= 0; 11 | } 12 | 13 | @Property 14 | void lengthOfConcatenatedStringIsGreaterThanLengthOfEach( 15 | @ForAll String string1, @ForAll String string2 16 | ) { 17 | String conc = string1 + string2; 18 | Assertions.assertThat(conc.length()).isGreaterThan(string1.length()); 19 | Assertions.assertThat(conc.length()).isGreaterThan(string2.length()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/PropertyDefaultsExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | @PropertyDefaults(tries = 10, shrinking = ShrinkingMode.FULL) 6 | class PropertyDefaultsExamples { 7 | 8 | @Property 9 | void aLongRunningProperty(@ForAll String aString) {} 10 | 11 | @Property(shrinking = ShrinkingMode.OFF) 12 | void anotherLongRunningProperty(@ForAll String aString) {} 13 | } 14 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/RandomDistributionExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.statistics.*; 5 | 6 | class RandomDistributionExamples { 7 | 8 | @Property(generation = GenerationMode.RANDOMIZED) 9 | @StatisticsReport(format = Histogram.class) 10 | void gaussianDistributedIntegers(@ForAll("gaussians") int aNumber) { 11 | Statistics.collect(aNumber); 12 | } 13 | 14 | @Provide 15 | Arbitrary gaussians() { 16 | return Arbitraries 17 | .integers() 18 | .between(0, 20) 19 | .shrinkTowards(10) 20 | .withDistribution(RandomDistribution.gaussian()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/SelfMadeAnnotationExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class SelfMadeAnnotationExamples { 6 | 7 | @Property(tries = 10) @Report(Reporting.GENERATED) 8 | void aGermanText(@ForAll @GermanText String aText) {} 9 | } 10 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/SimpleExampleTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import static org.assertj.core.api.Assertions.*; 4 | 5 | import net.jqwik.api.*; 6 | import org.assertj.core.data.*; 7 | 8 | class SimpleExampleTests implements AutoCloseable { 9 | @Example 10 | void succeeding() { 11 | assertThat(Math.sqrt(15)).isCloseTo(3.872, Offset.offset(0.01)); 12 | } 13 | 14 | @Example 15 | void failing() { 16 | fail("failing"); 17 | } 18 | 19 | // Executed after each test case 20 | public void close() { } 21 | 22 | @Group 23 | class AGroupOfCoherentTests { 24 | @Example 25 | void anotherSuccess() { } 26 | } 27 | } -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/SimpleLifecycleTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class SimpleLifecycleTests implements AutoCloseable { 6 | 7 | SimpleLifecycleTests() { 8 | System.out.println("Before each"); 9 | } 10 | 11 | @Example 12 | void anExample() { 13 | System.out.println("anExample"); 14 | } 15 | 16 | @Property(tries = 5) 17 | void aProperty(@ForAll String aString) { 18 | System.out.println("aProperty: " + aString); 19 | } 20 | 21 | @Override 22 | public void close() throws Exception { 23 | System.out.println("After each"); 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/TaggingExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | @Tag("integration-test") 6 | class TaggingExamples { 7 | 8 | @Property 9 | @Tag("fast") 10 | void aFastProperty() { } 11 | 12 | @Example 13 | @Tag("slow") @Tag("involved") 14 | void aSlowTest() { } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/TestsWithGroups.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class TestsWithGroups { 6 | 7 | @Property 8 | void outer(@ForAll String aString) { 9 | } 10 | 11 | @Group 12 | class Group1 { 13 | @Property 14 | void group1Property(@ForAll String aString) { 15 | } 16 | 17 | @Group 18 | class Subgroup { 19 | @Property 20 | void subgroupProperty(@ForAll String aString) { 21 | } 22 | } 23 | } 24 | 25 | @Group 26 | class Group2 { 27 | @Property 28 | void group2Property(@ForAll String aString) { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitraryconfigurator/NotNull.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitraryconfigurator; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Retention(RetentionPolicy.RUNTIME) 6 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER }) 7 | public @interface NotNull { 8 | /* Empty on purpose */ 9 | } 10 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitraryconfigurator/NotNullConfigurator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitraryconfigurator; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.configurators.*; 7 | 8 | public class NotNullConfigurator extends ArbitraryConfiguratorBase { 9 | public Arbitrary configure(Arbitrary arbitrary, NotNull notNull) { 10 | return arbitrary.filter(Objects::nonNull); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitraryconfigurator/NotNullProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitraryconfigurator; 2 | 3 | import org.assertj.core.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | class NotNullProperties { 8 | @Property 9 | void notNullStringsOnly(@ForAll("myStrings") @NotNull String aString) { 10 | Assertions.assertThat(aString).isNotNull(); 11 | } 12 | 13 | @Provide 14 | Arbitrary myStrings() { 15 | return Arbitraries.strings().alpha().injectNull(0.1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitraryconfigurator/Odd.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitraryconfigurator; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE }) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface Odd { 8 | } 9 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitraryconfigurator/OddProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitraryconfigurator; 2 | 3 | import java.math.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | class OddProperties { 8 | 9 | @Property @Report(Reporting.GENERATED) 10 | boolean oddIntegersOnly(@ForAll @Odd int aNumber) { 11 | return Math.abs(aNumber % 2) == 1; 12 | } 13 | 14 | @Property @Report(Reporting.GENERATED) 15 | boolean oddBigIntegersOnly(@ForAll @Odd BigInteger aNumber) { 16 | return Math.abs(aNumber.longValueExact() % 2) == 1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/arbitrarydecorator/ArbitraryDecoratorExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.arbitrarydecorator; 2 | 3 | import net.jqwik.api.*; 4 | 5 | @PropertyDefaults(tries = 20) 6 | public class ArbitraryDecoratorExamples { 7 | 8 | @Property 9 | void complexNumbers(@ForAll("complex") ComplexNumber number) { 10 | System.out.println(number); 11 | } 12 | 13 | @Provide 14 | Arbitrary complex() { 15 | return new ComplexNumberArbitrary(); 16 | } 17 | 18 | @Property 19 | void rationalNumbers(@ForAll("rationalOnly") ComplexNumber number) { 20 | System.out.println(number); 21 | } 22 | 23 | @Provide 24 | Arbitrary rationalOnly() { 25 | return new ComplexNumberArbitrary().withoutImaginaryPart(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/ConstrainedBy.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public @interface ConstrainedBy { 4 | 5 | Class value(); 6 | } 7 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/Constraint.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public interface Constraint { 4 | 5 | boolean isValid(T value); 6 | } 7 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/ContractFor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public @interface ContractFor { 4 | 5 | Class value(); 6 | 7 | @interface Require { 8 | 9 | } 10 | 11 | @interface Ensure { 12 | 13 | } 14 | 15 | @interface Invariant { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/EuroConverter.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public class EuroConverter { 4 | private final RateProvider rateProvider; 5 | 6 | public EuroConverter(RateProvider rateProvider) { 7 | this.rateProvider = rateProvider; 8 | } 9 | 10 | public double convert(double amount, String fromCurrency) { 11 | return rateProvider.rate(fromCurrency, "EUR") * amount; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/RateProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public interface RateProvider { 4 | double rate(String fromCurrency, String toCurrency); 5 | } 6 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/contracts/eurocalc/SimpleRateProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.contracts.eurocalc; 2 | 3 | public class SimpleRateProvider implements RateProvider { 4 | @Override 5 | public double rate(String fromCurrency, String toCurrency) { 6 | checkCurrencyValid(fromCurrency); 7 | checkCurrencyValid(toCurrency); 8 | return 1.0; 9 | } 10 | 11 | private void checkCurrencyValid(String currency) { 12 | switch (currency) { 13 | case "EUR": 14 | break; 15 | case "USD": 16 | break; 17 | case "CHF": 18 | break; 19 | case "CAD": 20 | break; 21 | default: { 22 | throw new IllegalArgumentException(currency + " is not a valid currency"); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/defaultprovider/AlternativeStringArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.defaultprovider; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.providers.*; 5 | 6 | import java.util.*; 7 | 8 | public class AlternativeStringArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(String.class); 12 | } 13 | 14 | @Override 15 | public int priority() { 16 | return -1; 17 | // return 1; 18 | } 19 | 20 | @Override 21 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 22 | return Collections.singleton(Arbitraries.just("A String")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/defaultprovider/Money.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.defaultprovider; 2 | 3 | import java.math.*; 4 | 5 | public class Money { 6 | 7 | private final BigDecimal amount; 8 | private final String currency; 9 | 10 | public BigDecimal getAmount() { 11 | return amount; 12 | } 13 | 14 | public String getCurrency() { 15 | return currency; 16 | } 17 | 18 | public Money(BigDecimal amount, String currency) { 19 | this.amount = amount; 20 | this.currency = currency; 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return String.format("%s %s", amount, currency); 26 | } 27 | 28 | public Money times(int factor) { 29 | return new Money(amount.multiply(new BigDecimal(factor)), currency); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/defaultprovider/MoneyProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.defaultprovider; 2 | 3 | import java.math.*; 4 | 5 | import org.assertj.core.api.*; 6 | 7 | import net.jqwik.api.*; 8 | 9 | class MoneyProperties { 10 | 11 | @Property 12 | void moneyCanBeMultiplied(@ForAll Money money) { 13 | Money times2 = money.times(2); 14 | Assertions.assertThat(times2.getCurrency()).isEqualTo(money.getCurrency()); 15 | Assertions.assertThat(times2.getAmount()).isEqualTo(money.getAmount().multiply(new BigDecimal(2))); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/defaultprovider/StringProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.defaultprovider; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class StringProperties { 6 | 7 | @Property @Report(Reporting.GENERATED) 8 | void aString(@ForAll String aString) {} 9 | } 10 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/domains/Address.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.domains; 2 | 3 | public class Address { 4 | 5 | private final Street street; 6 | private final int number; 7 | private final City city; 8 | 9 | public Address(Street street, int number, City city) { 10 | this.street = street; 11 | this.number = number; 12 | this.city = city; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.format("%s %s, %s", number, street, city); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/domains/AddressProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.domains; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.domains.*; 5 | 6 | class AddressProperties { 7 | 8 | @Property 9 | @Domain(AmericanAddresses.class) 10 | @Report(Reporting.GENERATED) 11 | void anAddressWithAStreetNumber(@ForAll Address anAddress, @ForAll int streetNumber) { 12 | } 13 | 14 | @Property 15 | @Domain(AmericanAddresses.class) 16 | void willFailBecauseGlobalDomainIsNotPresent(@ForAll Address anAddress, @ForAll String anyString) { 17 | } 18 | 19 | @Property 20 | @Domain(DomainContext.Global.class) 21 | @Domain(AmericanAddresses.class) 22 | void globalDomainCanBeAdded(@ForAll Address anAddress, @ForAll String anyString) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/domains/City.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.domains; 2 | 3 | public class City { 4 | 5 | private String name; 6 | private State state; 7 | private String zipCode; 8 | 9 | public City(String name, State state, String zipCode) { 10 | this.name = name; 11 | this.state = state; 12 | this.zipCode = zipCode; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.format("%s, %s %s", name, state.name(), zipCode); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/domains/State.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.domains; 2 | 3 | public enum State { 4 | 5 | AL, AK, CA, FL, HI, MA, MI, MN, NE, OR, TX, UT, WA 6 | } 7 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/domains/Street.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.domains; 2 | 3 | public class Street { 4 | 5 | private String name; 6 | 7 | public Street(String name) { 8 | this.name = name; 9 | } 10 | 11 | @Override 12 | public String toString() { 13 | return name; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/kotlin/InlineClassExamples.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.kotlin 2 | 3 | import net.jqwik.api.ForAll 4 | import net.jqwik.api.Property 5 | import net.jqwik.api.constraints.StringLength 6 | 7 | class InlineClassExamples { 8 | 9 | @Property 10 | fun test2(@ForAll password: @StringLength(51) SecurePassword) { 11 | assert(password.length() == 51) 12 | } 13 | 14 | @JvmInline 15 | value class SecurePassword(private val s: String) { 16 | fun length() = s.length 17 | } 18 | } -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/kotlin/KotlinSingletonExample.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.kotlin 2 | 3 | import net.jqwik.api.Example 4 | import org.assertj.core.api.Assertions 5 | 6 | // One of the examples will fail 7 | object KotlinSingletonExample { 8 | 9 | var lastExample: String = "" 10 | 11 | @Example 12 | fun example1() { 13 | Assertions.assertThat(lastExample).isEmpty() 14 | lastExample = "example1" 15 | } 16 | 17 | @Example 18 | fun example2() { 19 | Assertions.assertThat(lastExample).isEmpty() 20 | lastExample = "example2" 21 | } 22 | } -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/kotlin/NullabilityExamples.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.kotlin 2 | 3 | import net.jqwik.api.ForAll 4 | import net.jqwik.api.Property 5 | import net.jqwik.api.constraints.WithNull 6 | 7 | class NullabilityExamples { 8 | 9 | @Property 10 | fun alsoGenerateNulls(@ForAll nullOrString: String?) { 11 | println(nullOrString) 12 | } 13 | 14 | @Property(tries = 100) 15 | fun generateNullsInList(@ForAll list: List<@WithNull String>) { 16 | println(list) 17 | } 18 | } -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/kotlin/UseTypeWithDataclassesExamples.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.kotlin 2 | 3 | import net.jqwik.api.ForAll 4 | import net.jqwik.api.Property 5 | import net.jqwik.api.constraints.UseType 6 | import net.jqwik.web.api.Email 7 | 8 | class UseTypeWithDataclassesExamples { 9 | 10 | @Property(tries = 10) 11 | fun generateCommunications(@ForAll @UseType communication: Communication) { 12 | println(communication) 13 | } 14 | } 15 | 16 | 17 | data class Person(val firstName: String, val lastName: String) 18 | 19 | data class User(val identity: Person, @Email val email: String) 20 | 21 | data class Communication(val from: User, val to: User) -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/lifecycle/BeforeTryMemberExample.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.lifecycle; 2 | 3 | import org.assertj.core.api.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.lifecycle.*; 7 | 8 | class BeforeTryMemberExample { 9 | 10 | @BeforeTry 11 | int theAnswer = 42; 12 | 13 | @Property 14 | void theAnswerIsAlways42(@ForAll int addend) { 15 | Assertions.assertThat(theAnswer).isEqualTo(42); 16 | theAnswer += addend; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/lifecycle/SkipExecutionHookExample.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.lifecycle; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.lifecycle.*; 5 | 6 | class SkipExecutionHookExample { 7 | 8 | @Property 9 | @AddLifecycleHook(OnMacOnly.class) 10 | void myProperty(@ForAll int anInt) { 11 | } 12 | 13 | } 14 | 15 | class OnMacOnly implements SkipExecutionHook { 16 | @Override 17 | public SkipResult shouldBeSkipped(final LifecycleContext context) { 18 | if (System.getProperty("os.name").equals("Mac OS X")) { 19 | return SkipResult.doNotSkip(); 20 | } 21 | return SkipResult.skip("Only on Mac"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/lifecycle/TimingExtensionExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.lifecycle; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.constraints.*; 5 | 6 | class TimingExtensionExamples { 7 | 8 | @Property 9 | @Timing 10 | void fastProperty(@ForAll int anInt) { 11 | } 12 | 13 | @Property(tries = 50) 14 | @Timing 15 | void slowProperty(@ForAll @IntRange(min = 10, max = 100) int delay) throws InterruptedException { 16 | Thread.sleep(delay); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/stateful/mystack/ClearAction.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.stateful.mystack; 2 | 3 | import java.io.*; 4 | 5 | import net.jqwik.api.stateful.*; 6 | import org.assertj.core.api.*; 7 | 8 | class ClearAction implements Action, Serializable { 9 | 10 | @Override 11 | public MyStringStack run(MyStringStack stack) { 12 | stack.clear(); 13 | Assertions.assertThat(stack.isEmpty()).isTrue(); 14 | return stack; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "clear"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/time/DateTimeExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.time; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.time.api.*; 8 | 9 | class DateTimeExamples { 10 | 11 | @Property(tries = 10) 12 | void calendarsFromInstants(@ForAll("calendars") Calendar cal) { 13 | System.out.println(cal.getTime()); 14 | } 15 | 16 | @Provide 17 | Arbitrary calendars() { 18 | return DateTimes.instants().map(instant -> { 19 | ZonedDateTime zdt = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault()); 20 | return GregorianCalendar.from(zdt); 21 | }); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/types/Party.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.types; 2 | 3 | import java.util.*; 4 | 5 | public class Party { 6 | 7 | final String name; 8 | final Set people; 9 | 10 | public Party(String name, Set people) { 11 | this.name = name; 12 | this.people = people; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "Party{" + 18 | "name='" + name + '\'' + 19 | ", people=" + people + 20 | '}'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/types/Person.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.types; 2 | 3 | public class Person { 4 | 5 | public String name; 6 | public final int age; 7 | 8 | public static Person withFirstAndLast(String first, String last) { 9 | return new Person(first + " " + last, 0); 10 | } 11 | 12 | public Person(String name, int age) { 13 | if (name == null || name.trim().isEmpty()) 14 | throw new IllegalArgumentException(); 15 | if (age < 0 || age > 130) 16 | throw new IllegalArgumentException(); 17 | 18 | this.name = name; 19 | this.age = age; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return String.format("%s (%d)", name, age); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/web/EmailExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.web; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.web.api.*; 5 | 6 | import static org.assertj.core.api.Assertions.*; 7 | 8 | class EmailExamples { 9 | 10 | @Property 11 | void defaultEmailAddresses(@ForAll @Email String email) { 12 | assertThat(email).contains("@"); 13 | } 14 | 15 | @Property 16 | void restrictedEmailAddresses(@ForAll @Email(quotedLocalPart = false, ipv4Host = false, ipv6Host = false) String email) { 17 | assertThat(email).contains("@"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /documentation/src/test/java/net/jqwik/docs/web/WebDomainExamples.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.docs.web; 2 | 3 | import org.assertj.core.api.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.web.api.*; 7 | 8 | class WebDomainExamples { 9 | 10 | @Property 11 | @Report(Reporting.GENERATED) 12 | void topLevelDomainCannotHaveSingleLetter(@ForAll @WebDomain String domain) { 13 | int lastDot = domain.lastIndexOf('.'); 14 | String tld = domain.substring(lastDot + 1); 15 | Assertions.assertThat(tld).hasSizeGreaterThan(1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /documentation/src/test/resources/META-INF/services/net.jqwik.api.SampleReportingFormat: -------------------------------------------------------------------------------- 1 | net.jqwik.docs.reporting.SampleReportingExamples$LocalDateFormat -------------------------------------------------------------------------------- /documentation/src/test/resources/META-INF/services/net.jqwik.api.configurators.ArbitraryConfigurator: -------------------------------------------------------------------------------- 1 | net.jqwik.docs.arbitraryconfigurator.OddConfigurator 2 | net.jqwik.docs.arbitraryconfigurator.NotNullConfigurator -------------------------------------------------------------------------------- /documentation/src/test/resources/META-INF/services/net.jqwik.api.providers.ArbitraryProvider: -------------------------------------------------------------------------------- 1 | net.jqwik.docs.defaultprovider.MoneyArbitraryProvider 2 | net.jqwik.docs.defaultprovider.AlternativeStringArbitraryProvider 3 | -------------------------------------------------------------------------------- /documentation/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | #jqwik.database=.jqwik-database 2 | #jqwik.failures.runfirst=false 3 | #jqwik.tries.default=1000 4 | #jqwik.maxdiscardratio.default=5 5 | #jqwik.reporting.usejunitplatform=false 6 | #jqwik.reporting.onlyfailures=false 7 | #jqwik.generation.default=AUTO 8 | #jqwik.failures.after.default=SAMPLE_FIRST 9 | #jqwik.edgecases.default=MIXIN 10 | #jqwik.shrinking.default=BOUNDED 11 | #jqwik.shrinking.bounded.seconds=10 -------------------------------------------------------------------------------- /documentation/src/test/resources/log4j2-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/JqwikConfiguration.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine; 2 | 3 | public interface JqwikConfiguration { 4 | PropertyAttributesDefaults propertyDefaultValues(); 5 | 6 | TestEngineConfiguration testEngineConfiguration(); 7 | 8 | boolean useJunitPlatformReporter(); 9 | 10 | boolean reportOnlyFailures(); 11 | } 12 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/TestEngineConfiguration.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine; 2 | 3 | import java.util.*; 4 | 5 | import org.junit.platform.engine.*; 6 | 7 | import net.jqwik.engine.recording.*; 8 | 9 | public interface TestEngineConfiguration { 10 | TestRunRecorder recorder(); 11 | 12 | TestRunData previousRun(); 13 | 14 | Set previousFailures(); 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/descriptor/JqwikDescriptor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.descriptor; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.*; 5 | 6 | import org.junit.platform.engine.*; 7 | 8 | import net.jqwik.api.domains.*; 9 | 10 | public interface JqwikDescriptor extends TestDescriptor { 11 | Set getDomains(); 12 | 13 | AnnotatedElement getAnnotatedElement(); 14 | 15 | default Optional getJqwikParent() { 16 | return getParent() 17 | .filter(parent -> parent instanceof JqwikDescriptor) 18 | .map(parent -> (JqwikDescriptor) parent); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/descriptor/JqwikEngineDescriptor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.descriptor; 2 | 3 | import org.junit.platform.engine.*; 4 | import org.junit.platform.engine.support.descriptor.*; 5 | 6 | import net.jqwik.engine.*; 7 | 8 | public class JqwikEngineDescriptor extends EngineDescriptor { 9 | private static final String DISPLAY_NAME = "jqwik (JUnit Platform)"; 10 | private final JqwikConfiguration configuration; 11 | 12 | public JqwikEngineDescriptor(UniqueId uniqueId, JqwikConfiguration configuration) { 13 | super(uniqueId, DISPLAY_NAME); 14 | this.configuration = configuration; 15 | } 16 | 17 | public JqwikConfiguration getConfiguration() { 18 | return configuration; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/descriptor/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.descriptor; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/ElementResolver.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery; 2 | 3 | import org.junit.platform.engine.*; 4 | 5 | import java.lang.reflect.*; 6 | import java.util.*; 7 | 8 | interface ElementResolver { 9 | 10 | Set resolveElement(AnnotatedElement element, TestDescriptor parent); 11 | 12 | Optional resolveUniqueId(UniqueId.Segment segment, TestDescriptor parent); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.discovery; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsContainerAGroup.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.util.function.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.junit.platform.commons.support.AnnotationSupport.*; 8 | 9 | public class IsContainerAGroup implements Predicate> { 10 | 11 | private final static Predicate> isTopLevelClass = new IsTopLevelClass(); 12 | 13 | @Override 14 | public boolean test(Class candidate) { 15 | return isGroup(candidate) && !isTopLevelClass.test(candidate); 16 | } 17 | 18 | private boolean isGroup(Class candidate) { 19 | return isAnnotated(candidate, Group.class); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsDiscoverableTestMethod.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.function.*; 5 | 6 | import static org.junit.platform.commons.support.ModifierSupport.*; 7 | 8 | public class IsDiscoverableTestMethod implements Predicate { 9 | 10 | @Override 11 | public boolean test(Method candidate) { 12 | return (!isAbstract(candidate) && !isPrivate(candidate)); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsMethodAnnotatedWithProperty.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.function.*; 5 | 6 | import net.jqwik.api.*; 7 | 8 | import static org.junit.platform.commons.support.AnnotationSupport.*; 9 | 10 | public class IsMethodAnnotatedWithProperty implements Predicate { 11 | 12 | @Override 13 | public boolean test(Method method) { 14 | return isAnnotated(method, Property.class); 15 | } 16 | } -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsPotentialTestContainer.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.util.function.*; 4 | 5 | import static org.junit.platform.commons.support.ModifierSupport.*; 6 | 7 | public class IsPotentialTestContainer implements Predicate> { 8 | 9 | @Override 10 | public boolean test(Class candidate) { 11 | if (isAbstract(candidate)) 12 | return false; 13 | if (isPrivate(candidate)) 14 | return false; 15 | if (candidate.isEnum()) 16 | return false; 17 | if (candidate.isLocalClass()) 18 | return false; 19 | return !candidate.isAnonymousClass(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsProperty.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.function.*; 5 | 6 | public class IsProperty implements Predicate { 7 | private final static IsDiscoverableTestMethod isDiscoverableTestMethod = new IsDiscoverableTestMethod(); 8 | private final static IsMethodAnnotatedWithProperty isMethodAnnotatedWithProperty = new IsMethodAnnotatedWithProperty(); 9 | 10 | @Override 11 | public boolean test(Method method) { 12 | return isDiscoverableTestMethod.and(isMethodAnnotatedWithProperty).test(method); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsScannableContainerClass.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.util.function.*; 4 | 5 | import static org.junit.platform.commons.support.ModifierSupport.*; 6 | 7 | public class IsScannableContainerClass implements Predicate> { 8 | 9 | private static final IsTestContainer isTestContainer = new IsTestContainer(); 10 | 11 | @Override 12 | public boolean test(Class candidate) { 13 | if (isPrivate(candidate)) 14 | return false; 15 | return isTestContainer.test(candidate); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/IsTopLevelClass.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.predicates; 2 | 3 | import java.util.function.*; 4 | 5 | public class IsTopLevelClass implements Predicate> { 6 | 7 | @Override 8 | public boolean test(Class candidate) { 9 | return candidate.getDeclaringClass() == null; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/predicates/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.discovery.predicates; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/specs/DiscoverySpec.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.discovery.specs; 2 | 3 | import java.lang.reflect.*; 4 | 5 | import org.junit.platform.engine.support.hierarchical.Node.*; 6 | 7 | public interface DiscoverySpec { 8 | 9 | boolean shouldBeDiscovered(T candidate); 10 | 11 | SkipResult shouldBeSkipped(T candidate); 12 | } 13 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/discovery/specs/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.discovery.specs; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/ExecutionTaskCreator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution; 2 | 3 | import org.junit.platform.engine.*; 4 | 5 | import net.jqwik.engine.execution.pipeline.*; 6 | 7 | @FunctionalInterface 8 | public interface ExecutionTaskCreator { 9 | ExecutionTask createTask( 10 | TestDescriptor descriptor, 11 | Pipeline pipeline, 12 | PropertyExecutionListener propertyExecutionListener 13 | ); 14 | } 15 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/ParametersGenerator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.lifecycle.*; 7 | 8 | public interface ParametersGenerator { 9 | 10 | boolean hasNext(); 11 | 12 | List> next(TryLifecycleContext context); 13 | 14 | int edgeCasesTotal(); 15 | 16 | int edgeCasesTried(); 17 | 18 | GenerationInfo generationInfo(String randomSeed); 19 | 20 | void reset(); 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/PropertyExecutionListener.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution; 2 | 3 | import org.junit.platform.engine.*; 4 | import org.junit.platform.engine.reporting.*; 5 | 6 | import net.jqwik.api.lifecycle.*; 7 | 8 | public interface PropertyExecutionListener { 9 | 10 | void executionSkipped(TestDescriptor testDescriptor, String reason); 11 | 12 | void executionStarted(TestDescriptor testDescriptor); 13 | 14 | void executionFinished(TestDescriptor testDescriptor, PropertyExecutionResult executionResult); 15 | 16 | void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/lifecycle/OutsideJqwikException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.lifecycle; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class OutsideJqwikException extends JqwikException { 6 | public OutsideJqwikException(String message) { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/lifecycle/RegisteredLifecycleHooks.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.lifecycle; 2 | 3 | import net.jqwik.api.lifecycle.*; 4 | import net.jqwik.engine.support.*; 5 | 6 | public class RegisteredLifecycleHooks { 7 | private static final LazyServiceLoaderCache serviceCache = new LazyServiceLoaderCache<>(LifecycleHook.class); 8 | 9 | public static Iterable getRegisteredHooks() { 10 | return serviceCache.getServices(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/lifecycle/TryLifecycleExecutor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.lifecycle; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.lifecycle.*; 6 | 7 | public interface TryLifecycleExecutor { 8 | 9 | TryExecutionResult execute(TryLifecycleContext tryLifecycleContext, List parameters); 10 | } 11 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/lifecycle/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.execution.lifecycle; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.execution; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/pipeline/DuplicateExecutionTaskException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.pipeline; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class DuplicateExecutionTaskException extends JqwikException { 6 | public DuplicateExecutionTaskException(ExecutionTask task) { 7 | super(String.format("Task [%s] has already been submitted.", task.toString())); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/pipeline/Pipeline.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.pipeline; 2 | 3 | public interface Pipeline { 4 | 5 | void submit(ExecutionTask task, ExecutionTask... predecessors); 6 | } 7 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/pipeline/PredecessorNotSubmittedException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.pipeline; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class PredecessorNotSubmittedException extends JqwikException { 6 | 7 | public PredecessorNotSubmittedException(ExecutionTask task, ExecutionTask predecessor) { 8 | super(String.format("Predecessor [%s] must be submitted before [%s] can be run.", predecessor.toString(), task.toString())); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/pipeline/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.execution.pipeline; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/BuilderBasedLineReporter.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | class BuilderBasedLineReporter implements LineReporter { 4 | 5 | private final StringBuilder builder; 6 | private final int baseIndent; 7 | 8 | BuilderBasedLineReporter(StringBuilder builder, int baseIndent) { 9 | this.builder = builder; 10 | this.baseIndent = baseIndent; 11 | } 12 | 13 | @Override 14 | public void addLine(int indentLevel, String line) { 15 | int effectiveIndent = indentLevel + baseIndent; 16 | String indentation = LineReporter.multiply(' ', effectiveIndent * 2); 17 | builder.append(String.format("%s%s%n", indentation, line)); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/CircularDependencyReport.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | import java.util.*; 4 | 5 | class CircularDependencyReport extends ValueReport { 6 | 7 | private final Object value; 8 | 9 | CircularDependencyReport(Optional label, Object value) { 10 | super(label); 11 | this.value = value; 12 | } 13 | 14 | @Override 15 | public String singleLineReport() { 16 | return String.format("circular-dependency<%s@%s>", label.orElse(value.getClass().getName()), System.identityHashCode(value)); 17 | } 18 | 19 | @Override 20 | public void report(LineReporter lineReporter, int indentLevel, String appendix) { 21 | lineReporter.addLine(indentLevel, singleLineReport() + appendix); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/LineReporter.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | public interface LineReporter { 4 | 5 | void addLine(int indentLevel, String line); 6 | 7 | static String multiply(char c, int times) { 8 | StringBuilder builder = new StringBuilder(); 9 | for (int j = 0; j < times; j++) { 10 | builder.append(c); 11 | } 12 | return builder.toString(); 13 | } 14 | 15 | default void addUnderline(int indentLevel, int length) { 16 | String underline = LineReporter.multiply('-', length); 17 | addLine(indentLevel, underline); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/NullReportingFormat.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class NullReportingFormat implements SampleReportingFormat { 8 | @Override 9 | // Never used 10 | public boolean appliesTo(Object value) { 11 | return true; 12 | } 13 | 14 | @Override 15 | public Object report(Object value) { 16 | return value; 17 | } 18 | 19 | @Override 20 | public Optional label(Object value) { 21 | return Optional.empty(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/OptionalReportingFormat.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class OptionalReportingFormat implements SampleReportingFormat { 8 | @Override 9 | public boolean appliesTo(Object value) { 10 | return value instanceof Optional; 11 | } 12 | 13 | @Override 14 | public Object report(Object value) { 15 | Optional optional = (Optional) value; 16 | 17 | return Collections.singletonList(optional.orElse(null)); 18 | } 19 | 20 | @Override 21 | public Optional label(Object value) { 22 | return Optional.of("Optional"); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/StreamReportingFormat.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.engine.properties.arbitraries.*; 7 | 8 | public class StreamReportingFormat implements SampleReportingFormat { 9 | @Override 10 | public boolean appliesTo(Object value) { 11 | return value instanceof ReportableStream; 12 | } 13 | 14 | @Override 15 | public Object report(Object value) { 16 | @SuppressWarnings("rawtypes") 17 | ReportableStream stream = (ReportableStream) value; 18 | return stream.values(); 19 | } 20 | 21 | @Override 22 | public Optional label(Object value) { 23 | return Optional.of("Stream.of "); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/execution/reporting/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.execution.reporting; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/ActionChainFacadeImpl.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.facades; 2 | 3 | import java.util.function.*; 4 | 5 | import net.jqwik.api.state.*; 6 | import net.jqwik.engine.properties.state.*; 7 | 8 | import org.jspecify.annotations.*; 9 | 10 | /** 11 | * Is loaded through reflection in api module 12 | */ 13 | public class ActionChainFacadeImpl extends ActionChain.ActionChainFacade { 14 | @Override 15 | public ActionChainArbitrary startWith(Supplier initialSupplier) { 16 | return new DefaultActionChainArbitrary<>(initialSupplier); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/ChainFacadeImpl.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.facades; 2 | 3 | import java.util.*; 4 | import java.util.function.*; 5 | 6 | import net.jqwik.api.Tuple.*; 7 | import net.jqwik.api.state.*; 8 | import net.jqwik.engine.properties.state.*; 9 | 10 | import org.jspecify.annotations.*; 11 | 12 | /** 13 | * Is loaded through reflection in api module 14 | */ 15 | public class ChainFacadeImpl extends Chain.ChainFacade { 16 | 17 | @Override 18 | public ChainArbitrary startWith(Supplier initialSupplier) { 19 | return new DefaultChainArbitrary<>(initialSupplier); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/EdgeCasesFacadeImpl.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.facades; 2 | 3 | import java.util.*; 4 | import java.util.function.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.engine.properties.arbitraries.*; 8 | 9 | import org.jspecify.annotations.*; 10 | 11 | /** 12 | * Is loaded through reflection in api module 13 | */ 14 | public class EdgeCasesFacadeImpl extends EdgeCases.EdgeCasesFacade { 15 | 16 | @Override 17 | public EdgeCases fromSuppliers(final List>> suppliers) { 18 | return EdgeCasesSupport.fromSuppliers(suppliers); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/ReflectionSupportFacadeImpl.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.facades; 2 | 3 | import net.jqwik.api.facades.*; 4 | import net.jqwik.engine.support.*; 5 | 6 | public class ReflectionSupportFacadeImpl extends ReflectionSupportFacade { 7 | 8 | @Override 9 | public T newInstanceInTestContext(Class clazz, Object context) { 10 | return JqwikReflectionSupport.newInstanceInTestContext(clazz, context); 11 | } 12 | 13 | @Override 14 | public T newInstanceWithDefaultConstructor(Class clazz) { 15 | return JqwikReflectionSupport.newInstanceWithDefaultConstructor(clazz); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/RegisteredTypeUsageEnhancers.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.facades; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.providers.*; 6 | import net.jqwik.engine.support.*; 7 | 8 | public class RegisteredTypeUsageEnhancers { 9 | 10 | private static final LazyServiceLoaderCache serviceCache = new LazyServiceLoaderCache<>(TypeUsage.Enhancer.class); 11 | 12 | public static List getEnhancers() { 13 | return Collections.unmodifiableList(serviceCache.getServices()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/facades/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.facades; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/hooks/lifecycle/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.hooks.lifecycle; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/hooks/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.hooks; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/hooks/statistics/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.hooks.statistics; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/ArbitraryResolver.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.engine.support.*; 7 | 8 | public interface ArbitraryResolver { 9 | Set> forParameter(MethodParameter parameter); 10 | } 11 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/DataResolver.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties; 2 | 3 | import java.lang.reflect.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | 8 | public interface DataResolver { 9 | Optional> forMethod(Method method); 10 | } 11 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/FailOnFixedSeedException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class FailOnFixedSeedException extends JqwikException { 6 | public FailOnFixedSeedException(String message) { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/ForAllParametersGenerator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public interface ForAllParametersGenerator extends Iterator>> { 8 | 9 | default int edgeCasesTotal() { 10 | return 0; 11 | } 12 | 13 | default int edgeCasesTried() { 14 | return 0; 15 | } 16 | 17 | void reset(); 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/IncompatibleDataException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class IncompatibleDataException extends JqwikException { 6 | public IncompatibleDataException(String message) { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/ArbitrariesSupport.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ArbitrariesSupport { 6 | public static int maxNumberOfElements(Arbitrary elementArbitrary, int defaultNumber) { 7 | return elementArbitrary 8 | .exhaustive() 9 | .map(generator -> { 10 | long maxCount = generator.maxCount(); 11 | return (int) Math.min(maxCount, defaultNumber); 12 | }) 13 | .orElse(defaultNumber); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/NotAFunctionalTypeException.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class NotAFunctionalTypeException extends JqwikException { 6 | public NotAFunctionalTypeException(Class functionClass) { 7 | super(String.format("%s is not a functional type", functionClass.getName())); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/TypedCloneable.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public abstract class TypedCloneable implements Cloneable { 6 | 7 | @SuppressWarnings("unchecked") 8 | protected > A typedClone() { 9 | try { 10 | return (A) this.clone(); 11 | } catch (CloneNotSupportedException e) { 12 | throw new JqwikException(e.getMessage()); 13 | } 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/combinations/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.arbitraries.combinations; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/exhaustive/IterableBasedExhaustiveGenerator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries.exhaustive; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import org.jspecify.annotations.*; 8 | 9 | class IterableBasedExhaustiveGenerator implements ExhaustiveGenerator { 10 | 11 | final private Iterable iterable; 12 | final private long maxCount; 13 | 14 | IterableBasedExhaustiveGenerator(Iterable iterable, long maxCount) { 15 | this.iterable = iterable; 16 | this.maxCount = maxCount; 17 | } 18 | 19 | @Override 20 | public long maxCount() { 21 | return maxCount; 22 | } 23 | 24 | @Override 25 | public Iterator iterator() { 26 | return iterable.iterator(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/exhaustive/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.arbitraries.exhaustive; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.arbitraries; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/randomized/BiasedRandomDistribution.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries.randomized; 2 | 3 | import java.math.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class BiasedRandomDistribution implements RandomDistribution { 8 | @Override 9 | public RandomNumericGenerator createGenerator(int genSize, BigInteger min, BigInteger max, BigInteger center) { 10 | return new BiasedNumericGenerator(genSize, min, max, center); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "BiasedDistribution"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/randomized/FrequencyGenerator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.arbitraries.randomized; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.engine.properties.shrinking.*; 7 | import net.jqwik.engine.support.*; 8 | 9 | import org.jspecify.annotations.*; 10 | 11 | class FrequencyGenerator extends ChooseRandomlyByFrequency implements RandomGenerator { 12 | 13 | FrequencyGenerator(List> frequencies) { 14 | super(frequencies); 15 | } 16 | 17 | @Override 18 | public Shrinkable next(Random random) { 19 | return new ChooseValueShrinkable<>(apply(random), possibleValues()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/arbitraries/randomized/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.arbitraries.randomized; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/NotBlankConfigurator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.configurators; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.configurators.*; 5 | import net.jqwik.api.constraints.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class NotBlankConfigurator extends ArbitraryConfiguratorBase { 9 | 10 | @Override 11 | protected boolean acceptTargetType(TypeUsage targetType) { 12 | return targetType.isOfType(String.class); 13 | } 14 | 15 | public Arbitrary configure(Arbitrary arbitrary, NotBlank notBlank) { 16 | return arbitrary.filter(s -> s != null && !s.trim().isEmpty()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/RegisteredArbitraryConfigurators.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.configurators; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.configurators.*; 6 | import net.jqwik.engine.support.*; 7 | 8 | public class RegisteredArbitraryConfigurators { 9 | 10 | private static final LazyServiceLoaderCache serviceCache = new LazyServiceLoaderCache<>(ArbitraryConfigurator.class); 11 | 12 | public static List getConfigurators() { 13 | return Collections.unmodifiableList(serviceCache.getServices()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/ScaleConfigurator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.configurators; 2 | 3 | import net.jqwik.api.arbitraries.*; 4 | import net.jqwik.api.configurators.*; 5 | import net.jqwik.api.constraints.*; 6 | 7 | public class ScaleConfigurator extends ArbitraryConfiguratorBase { 8 | 9 | public BigDecimalArbitrary configure(BigDecimalArbitrary arbitrary, Scale scale) { 10 | return arbitrary.ofScale(scale.value()); 11 | } 12 | 13 | public DoubleArbitrary configure(DoubleArbitrary arbitrary, Scale scale) { 14 | return arbitrary.ofScale(scale.value()); 15 | } 16 | 17 | public FloatArbitrary configure(FloatArbitrary arbitrary, Scale scale) { 18 | return arbitrary.ofScale(scale.value()); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/WhitespaceConfigurator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.configurators; 2 | 3 | import net.jqwik.api.arbitraries.*; 4 | import net.jqwik.api.configurators.*; 5 | import net.jqwik.api.constraints.*; 6 | 7 | public class WhitespaceConfigurator extends ArbitraryConfiguratorBase { 8 | 9 | public StringArbitrary configure(StringArbitrary arbitrary, Whitespace whitespace) { 10 | return arbitrary.whitespace(); 11 | } 12 | 13 | public CharacterArbitrary configure(CharacterArbitrary arbitrary, Whitespace whitespace) { 14 | return arbitrary.whitespace(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/WithNullConfigurator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.configurators; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.configurators.*; 5 | import net.jqwik.api.constraints.*; 6 | 7 | public class WithNullConfigurator extends ArbitraryConfiguratorBase { 8 | 9 | public Arbitrary configure(Arbitrary arbitrary, WithNull withNull) { 10 | return arbitrary.injectNull(withNull.value()); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/configurators/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.configurators; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/shrinking/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.shrinking; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/state/InvariantFailedError.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.state; 2 | 3 | import org.opentest4j.*; 4 | 5 | public class InvariantFailedError extends AssertionFailedError { 6 | protected InvariantFailedError(String message, Throwable cause) { 7 | super(message, cause); 8 | this.setStackTrace(cause.getStackTrace()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/state/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.state; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/stateful/ActionGenerator.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.stateful; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.stateful.*; 7 | 8 | import org.jspecify.annotations.*; 9 | 10 | interface ActionGenerator { 11 | 12 | Action next(M model); 13 | 14 | List>> generated(); 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/stateful/ComprehensiveSizeOfListShrinker.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.stateful; 2 | 3 | import java.util.*; 4 | import java.util.stream.*; 5 | 6 | class ComprehensiveSizeOfListShrinker { 7 | 8 | Stream> shrink(List toShrink, int minSize) { 9 | if (toShrink.size() <= minSize) { 10 | return Stream.empty(); 11 | } 12 | Set> setOfSequences = new LinkedHashSet<>(); 13 | for (int i = 0; i < toShrink.size(); i++) { 14 | ArrayList newCandidate = new ArrayList<>(toShrink); 15 | newCandidate.remove(i); 16 | setOfSequences.add(newCandidate); 17 | } 18 | return setOfSequences.stream(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/stateful/InvariantFailedError.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.properties.stateful; 2 | 3 | class InvariantFailedError extends net.jqwik.engine.properties.state.InvariantFailedError { 4 | InvariantFailedError(String message, Throwable cause) { 5 | super(message, cause); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/properties/stateful/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.properties.stateful; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/BigDecimalArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.math.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | 9 | public class BigDecimalArbitraryProvider implements ArbitraryProvider { 10 | @Override 11 | public boolean canProvideFor(TypeUsage targetType) { 12 | return targetType.isAssignableFrom(BigDecimal.class); 13 | } 14 | 15 | @Override 16 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 17 | return Collections.singleton(Arbitraries.bigDecimals()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/BigIntegerArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.math.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | 9 | public class BigIntegerArbitraryProvider implements ArbitraryProvider { 10 | @Override 11 | public boolean canProvideFor(TypeUsage targetType) { 12 | return targetType.isAssignableFrom(BigInteger.class); 13 | } 14 | 15 | @Override 16 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 17 | return Collections.singleton(Arbitraries.bigIntegers()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/BooleanArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class BooleanArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Boolean.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.of(true, false)); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/ByteArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class ByteArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Byte.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.bytes()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/CharacterArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class CharacterArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Character.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.chars()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/DoubleArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class DoubleArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Double.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.doubles()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/EnumArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class EnumArbitraryProvider implements ArbitraryProvider { 9 | 10 | @Override 11 | public boolean canProvideFor(TypeUsage targetType) { 12 | return targetType.isEnum(); 13 | } 14 | 15 | @SuppressWarnings({"rawtypes", "unchecked"}) 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Arbitraries.of((Class) targetType.getRawType())); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/FloatArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class FloatArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Float.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.floats()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/IntegerArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class IntegerArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Integer.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.integers()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/IteratorArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class IteratorArbitraryProvider extends AbstractCollectionArbitraryProvider { 8 | 9 | @Override 10 | protected Class getProvidedType() { 11 | return Iterator.class; 12 | } 13 | 14 | @Override 15 | protected Arbitrary create(Arbitrary innerArbitrary) { 16 | return innerArbitrary.iterator(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/ListArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.List; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class ListArbitraryProvider extends AbstractCollectionArbitraryProvider { 8 | 9 | @Override 10 | protected Class getProvidedType() { 11 | return List.class; 12 | } 13 | 14 | @Override 15 | protected Arbitrary create(Arbitrary innerArbitrary) { 16 | return innerArbitrary.list(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/LongArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class LongArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Long.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.longs()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/ObjectArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class ObjectArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isOfType(Object.class); 12 | } 13 | 14 | @Override 15 | public int priority() { 16 | return 100; 17 | } 18 | 19 | @Override 20 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 21 | return Collections.singleton(Arbitraries.fromGenerator(random -> Shrinkable.unshrinkable(new Object()))); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/RandomArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class RandomArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isOfType(Random.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.randoms()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/SetArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.Set; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class SetArbitraryProvider extends AbstractCollectionArbitraryProvider { 8 | 9 | @Override 10 | protected Class getProvidedType() { 11 | return Set.class; 12 | } 13 | 14 | @Override 15 | protected Arbitrary create(Arbitrary innerArbitrary) { 16 | return innerArbitrary.set(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/ShortArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class ShortArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(Short.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.shorts()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/StreamArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.stream.Stream; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class StreamArbitraryProvider extends AbstractCollectionArbitraryProvider { 8 | 9 | @Override 10 | protected Class getProvidedType() { 11 | return Stream.class; 12 | } 13 | 14 | @Override 15 | protected Arbitrary create(Arbitrary innerArbitrary) { 16 | return innerArbitrary.stream(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/StringArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class StringArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isAssignableFrom(String.class); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.strings()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/VoidArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | public class VoidArbitraryProvider implements ArbitraryProvider { 9 | @Override 10 | public boolean canProvideFor(TypeUsage targetType) { 11 | return targetType.isVoid(); 12 | } 13 | 14 | @Override 15 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 16 | return Collections.singleton(Arbitraries.nothing()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/providers/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.providers; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/recording/TestRunRecorder.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.recording; 2 | 3 | public interface TestRunRecorder extends AutoCloseable { 4 | void record(TestRun testRun); 5 | 6 | default void close() {} 7 | 8 | TestRunRecorder NULL = testRun -> { }; 9 | } 10 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/recording/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.recording; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/support/LruCache.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.support; 2 | 3 | import java.util.*; 4 | 5 | public class LruCache extends LinkedHashMap { 6 | private final int maxSize; 7 | 8 | public LruCache(int maxSize) { 9 | super(maxSize + 1, 1, true); 10 | this.maxSize = maxSize; 11 | } 12 | 13 | @Override 14 | protected boolean removeEldestEntry(Map.Entry eldest) { 15 | return size() > maxSize; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/support/combinatorics/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.support.combinatorics; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/support/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.support; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/java/net/jqwik/engine/support/types/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.engine.support.types; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.Arbitraries$ArbitrariesFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ArbitrariesFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.Arbitrary$ArbitraryFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ArbitraryFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.Combinators$CombinatorsFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.CombinatorsFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.EdgeCases$EdgeCasesFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.EdgeCasesFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.ExhaustiveGenerator$ExhaustiveGeneratorFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ExhaustiveGeneratorFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.Functions$FunctionsFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.FunctionsFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.JavaBeanReportingFormat$JavaBeanReportingFormatFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.JavaBeanReportingFormatFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.RandomDistribution$RandomDistributionFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.RandomDistributionFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.RandomGenerator$RandomGeneratorFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.RandomGeneratorFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.SampleReportingFormat: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.execution.reporting.OptionalReportingFormat 2 | net.jqwik.engine.execution.reporting.ArrayReportingFormat 3 | net.jqwik.engine.execution.reporting.StreamReportingFormat 4 | net.jqwik.engine.properties.stateful.ActionSequenceReportingFormat -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.Shrinkable$ShrinkableFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ShrinkableFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.domains.DomainContext$DomainContextFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.DomainContextFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.facades.ReflectionSupportFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ReflectionSupportFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.facades.ShrinkingSupportFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ShrinkingSupportFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.facades.TestingSupportFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.TestingSupportFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.lifecycle.LifecycleHook: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.hooks.lifecycle.AutoCloseableHook 2 | net.jqwik.engine.hooks.lifecycle.ContainerLifecycleMethodsHook 3 | net.jqwik.engine.hooks.lifecycle.PropertyLifecycleMethodsHook 4 | net.jqwik.engine.hooks.lifecycle.TryLifecycleMethodsHook 5 | net.jqwik.engine.hooks.lifecycle.BeforeTryMembersHook 6 | net.jqwik.engine.hooks.DisabledHook 7 | net.jqwik.engine.hooks.statistics.StatisticsHook 8 | net.jqwik.engine.hooks.ResolveReporterHook 9 | -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.lifecycle.Store$StoreFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.StoreFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.providers.ArbitraryProvider: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.providers.CharacterArbitraryProvider 2 | net.jqwik.engine.providers.BooleanArbitraryProvider 3 | net.jqwik.engine.providers.IntegerArbitraryProvider 4 | net.jqwik.engine.providers.ByteArbitraryProvider 5 | net.jqwik.engine.providers.ShortArbitraryProvider 6 | net.jqwik.engine.providers.LongArbitraryProvider 7 | net.jqwik.engine.providers.DoubleArbitraryProvider 8 | net.jqwik.engine.providers.FloatArbitraryProvider 9 | net.jqwik.engine.providers.BigIntegerArbitraryProvider 10 | net.jqwik.engine.providers.BigDecimalArbitraryProvider 11 | net.jqwik.engine.providers.StringArbitraryProvider 12 | net.jqwik.engine.providers.RandomArbitraryProvider 13 | net.jqwik.engine.providers.ObjectArbitraryProvider 14 | -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.providers.TypeUsage$TypeUsageFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.TypeUsageFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.sessions.JqwikSession$JqwikSessionFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.JqwikSessionFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.state.ActionChain$ActionChainFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ActionChainFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.state.Chain$ChainFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.ChainFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/net.jqwik.api.statistics.Statistics$StatisticsFacade: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.facades.StatisticsFacadeImpl -------------------------------------------------------------------------------- /engine/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine: -------------------------------------------------------------------------------- 1 | net.jqwik.engine.JqwikTestEngine -------------------------------------------------------------------------------- /engine/src/test/java/examples/bugs/GeneratingHighDoubles.java: -------------------------------------------------------------------------------- 1 | package examples.bugs; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.constraints.Positive; 5 | 6 | class GeneratingHighDoubles { 7 | 8 | @Property(tries = 100) @Report(Reporting.GENERATED) 9 | void shouldGenerateEquallyDistributedValues(@ForAll @Positive double aDouble) { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/bugs/PositiveIntegersGenerationBug.java: -------------------------------------------------------------------------------- 1 | package examples.bugs; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.constraints.*; 5 | 6 | public class PositiveIntegersGenerationBug { 7 | 8 | @Property 9 | void shouldNotCrash(@ForAll @Positive int anInt) { 10 | String range = anInt < 10 ? "small" : (anInt < 100 ? "middle" : "large"); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/bugs/SampleInGeneratorBug.java: -------------------------------------------------------------------------------- 1 | package examples.bugs; 2 | 3 | import org.junit.jupiter.api.*; 4 | import org.junit.platform.commons.util.*; 5 | 6 | import net.jqwik.api.*; 7 | 8 | /** 9 | * see https://github.com/jqwik-team/jqwik/issues/205 10 | */ 11 | class SampleInGeneratorBug { 12 | 13 | @Property(tries = 10) 14 | void doNotThrowConcurrentModificationException() { 15 | Assertions.assertDoesNotThrow( 16 | () -> Arbitraries.strings() 17 | .map(it -> it + Arbitraries.strings().alpha().sample()) 18 | .filter(StringUtils::isNotBlank) 19 | .sample() 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/bugs/StringListGenerationBug.java: -------------------------------------------------------------------------------- 1 | package examples.bugs; 2 | 3 | import net.jqwik.api.*; 4 | 5 | import java.util.*; 6 | 7 | class StringListGenerationBug { 8 | 9 | @Property @Report(Reporting.GENERATED) 10 | void runsForever(@ForAll List aList) { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithDisabledTests/DisabledTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithDisabledTests; 2 | 3 | import org.assertj.core.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | public class DisabledTests { 8 | 9 | @Example 10 | @Disabled("a reason") 11 | void disabledSuccess() { 12 | 13 | } 14 | 15 | @Example 16 | @Disabled 17 | void disabledFailure(@ForAll String test) { 18 | Assertions.fail("should fail"); 19 | } 20 | 21 | @Example 22 | void success() { 23 | 24 | } 25 | 26 | @Group 27 | @Disabled 28 | public class DisabledGroup { 29 | 30 | @Example 31 | void successInGroup() { 32 | } 33 | 34 | @Example 35 | void failureInGroup() { 36 | Assertions.fail("should fail"); 37 | } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithErrors/AbstractContainerForOverloadedExamples.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithErrors; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public abstract class AbstractContainerForOverloadedExamples { 6 | 7 | @Property 8 | void overloadedExample(String aString) { 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithErrors/ContainerWithOOME.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithErrors; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ContainerWithOOME { 6 | 7 | @Property(tries = 10) 8 | void throwOutOfMemoryError(@ForAll int i) { 9 | throw new OutOfMemoryError(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithErrors/ContainerWithOverloadedExamples.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithErrors; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ContainerWithOverloadedExamples extends AbstractContainerForOverloadedExamples { 6 | 7 | @Example 8 | void succeeding() { 9 | } 10 | 11 | @Example 12 | void overloadedExample() { 13 | } 14 | 15 | @Example 16 | void overloadedExample(int aNumber) { 17 | } 18 | 19 | @Property 20 | boolean overloadedProperty(int aNumber) { 21 | return true; 22 | } 23 | 24 | @Property 25 | boolean overloadedProperty(String aString) { 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithErrors/ContainerWithStaticTestMethods.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithErrors; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ContainerWithStaticTestMethods { 6 | @Example 7 | static void staticExampleShouldBeSkipped() { 8 | } 9 | 10 | @Property 11 | static boolean staticPropertyShouldBeSkipped() { 12 | return true; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithFailings/Container1.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithFailings; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class Container1 { 6 | //@Property 7 | boolean succeed1() { 8 | return true; 9 | } 10 | 11 | 12 | @Property 13 | boolean fail1() { 14 | return false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithFailings/Container2.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithFailings; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class Container2 { 6 | //@Property 7 | boolean succeed2() { 8 | return true; 9 | } 10 | 11 | 12 | @Property 13 | boolean fail2() { 14 | return false; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithFailings/ContainerWithFailingConstructor.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithFailings; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ContainerWithFailingConstructor { 6 | 7 | public ContainerWithFailingConstructor() { 8 | throw new RuntimeException("failing constructor"); 9 | } 10 | 11 | @Example 12 | void success() {} 13 | } 14 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithFailings/ContainerWithStatistics.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithFailings; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.api.statistics.Statistics; 5 | 6 | public class ContainerWithStatistics { 7 | 8 | @Property(tries = 100, generation = GenerationMode.RANDOMIZED) 9 | void propertyWithStatistics(@ForAll boolean aBool) { 10 | Statistics.collect(aBool); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithInheritance/AbstractContainer.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithInheritance; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public abstract class AbstractContainer { 6 | 7 | @Example 8 | void exampleToInherit() { 9 | } 10 | 11 | @Example 12 | void exampleToOverride() { 13 | } 14 | 15 | @Example 16 | void exampleToDisable() { 17 | } 18 | 19 | @Group 20 | public class ContainerInAbstractClass { 21 | @Example 22 | void innerExampleToInherit() { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithInheritance/ContainerWithInheritance.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithInheritance; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class ContainerWithInheritance extends AbstractContainer implements InterfaceTests { 6 | 7 | @Example 8 | void example() { 9 | } 10 | 11 | @Example 12 | @Override 13 | void exampleToOverride() { 14 | } 15 | 16 | @Example 17 | @Override 18 | public void exampleToOverrideFromInterface() { 19 | } 20 | 21 | @Override 22 | void exampleToDisable() { 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithInheritance/InterfaceTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithInheritance; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public interface InterfaceTests { 6 | @Example 7 | default void exampleToInheritFromInterface() { 8 | } 9 | 10 | @Example 11 | default void exampleToOverrideFromInterface() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithNestedContainers/ClassWithContainer.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithNestedContainers; 2 | 3 | import net.jqwik.api.Example; 4 | import net.jqwik.api.Group; 5 | 6 | public class ClassWithContainer { 7 | 8 | @Group // should be ignored 9 | public static class NestedGroupAnnotatedContainer { 10 | @Example 11 | void example2() { 12 | 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithNestedContainers/TopLevelContainerWithGroups.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithNestedContainers; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class TopLevelContainerWithGroups { 6 | 7 | @Group 8 | class InnerContainer { 9 | @Example 10 | void innerExample() { 11 | } 12 | } 13 | 14 | @Group 15 | class AnotherInnerContainer { 16 | @Property 17 | boolean innerProperty() { 18 | return true; 19 | } 20 | } 21 | 22 | @Group 23 | public class InnerGroup { 24 | 25 | @Group 26 | public class InnerInnerGroup { 27 | @Property 28 | boolean innerInnerProperty() { 29 | return true; 30 | } 31 | } 32 | 33 | } 34 | 35 | @Example 36 | void topLevelExample() { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithNestedContainers/TopLevelContainerWithNoGroups.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithNestedContainers; 2 | 3 | import net.jqwik.api.*; 4 | 5 | @Group // TopLevel Group annotation is being ignored 6 | public class TopLevelContainerWithNoGroups { 7 | 8 | @Example 9 | void example1() { 10 | 11 | } 12 | 13 | public static class NestedContainer { 14 | @Example 15 | void example2() { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithProperties/PropertiesWithAssumptions.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithProperties; 2 | 3 | import net.jqwik.api.*; 4 | 5 | public class PropertiesWithAssumptions { 6 | 7 | @Property(tries = 10) 8 | boolean sixMustBeDivisor(@ForAll("multipleOf3") int i, @ForAll("multipleOf2") Integer j) { 9 | Assume.that((i + j) % 2 == 0); 10 | return (i * j) % 6 == 0; 11 | } 12 | 13 | @Provide 14 | Arbitrary multipleOf3() { 15 | return Arbitraries.integers().between(1, 1000).filter(i -> i % 3 == 0); 16 | } 17 | 18 | @Provide 19 | Arbitrary multipleOf2() { 20 | return Arbitraries.integers().between(1, 1000).filter(i -> i % 2 == 0); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithProperties/TestsForReporting.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithProperties; 2 | 3 | import org.junit.jupiter.api.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class TestsForReporting { 10 | 11 | @Example 12 | void succeeding() { 13 | } 14 | 15 | @Property(tries = 2) 16 | void succeedingPropertyWithoutParameters() { 17 | } 18 | 19 | @Example 20 | void succeedingWithForAll(@ForAll String aString) { 21 | } 22 | 23 | @Example 24 | void failing() { 25 | fail("failing"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithSeveralContainers/ExampleTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithSeveralContainers; 2 | 3 | import net.jqwik.api.*; 4 | 5 | import static org.assertj.core.api.Assertions.*; 6 | 7 | public class ExampleTests { 8 | 9 | @Example 10 | void succeeding() { 11 | } 12 | 13 | @Example 14 | String succeedingWithStringAsObject() { 15 | return "hallo"; 16 | } 17 | 18 | @Example 19 | void failingSimple() { 20 | fail("failing"); 21 | } 22 | 23 | @Example 24 | Object failingWithFalseAsObject() { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithSeveralContainers/MixedTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithSeveralContainers; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.testing.*; 5 | 6 | public class MixedTests { 7 | 8 | @Property 9 | boolean aProperty() { 10 | return true; 11 | } 12 | 13 | @Property 14 | void aVoidProperty() { 15 | if (true) 16 | throw new AssertionError("An Error"); 17 | String thisVariable = "will never be filled"; 18 | } 19 | 20 | @Property 21 | String propertyWithSomeReturnType() { 22 | return "it does not matter what I return"; 23 | } 24 | 25 | @Example 26 | void anExample() { 27 | } 28 | 29 | @Example 30 | boolean failingExample() { 31 | return false; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithSingleContainer/ClassWithoutTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithSingleContainer; 2 | 3 | public class ClassWithoutTests { 4 | } 5 | -------------------------------------------------------------------------------- /engine/src/test/java/examples/packageWithSingleContainer/SimpleExampleTests.java: -------------------------------------------------------------------------------- 1 | package examples.packageWithSingleContainer; 2 | 3 | import org.junit.jupiter.api.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.testing.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleExampleTests { 11 | 12 | @Example 13 | void succeeding() { 14 | } 15 | 16 | @Example 17 | static void staticExample() { 18 | } 19 | 20 | @Example 21 | @DisplayName("with Jupiter annotation") 22 | void withJupiterAnnotation() { 23 | } 24 | 25 | @Example 26 | void failing() { 27 | fail("failing"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/ArbitraryTestHelper.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api; 2 | 3 | import java.util.function.*; 4 | 5 | import net.jqwik.engine.*; 6 | import net.jqwik.testing.*; 7 | 8 | import org.jspecify.annotations.*; 9 | 10 | public class ArbitraryTestHelper { 11 | 12 | public static void assertAllGenerated(RandomGenerator generator, Consumer assertions) { 13 | Predicate checker = value -> { 14 | try { 15 | assertions.accept(value); 16 | return true; 17 | } catch (Throwable any) { 18 | return false; 19 | } 20 | }; 21 | TestingSupport.checkAllGenerated(generator, SourceOfRandomness.current(), checker); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/constraints/WhitespaceProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.constraints; 2 | 3 | import net.jqwik.api.ForAll; 4 | import net.jqwik.api.Group; 5 | import net.jqwik.api.Property; 6 | 7 | @Group 8 | class WhitespaceProperties { 9 | 10 | @Property 11 | boolean stringWithWhitespace(@ForAll @Whitespace String aString) { 12 | return aString.chars().allMatch(Character::isWhitespace); 13 | } 14 | 15 | @Property 16 | boolean characterWithWhitespace(@ForAll @Whitespace Character aChar) { 17 | return Character.isWhitespace(aChar); 18 | } 19 | 20 | @Property 21 | boolean charWithWhitespace(@ForAll @Whitespace char aChar) { 22 | return Character.isWhitespace(aChar); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/domains/ContextIsArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.domains; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | 8 | class ContextIsArbitraryProvider extends DomainContextBase implements ArbitraryProvider { 9 | 10 | @Override 11 | public boolean canProvideFor(TypeUsage targetType) { 12 | return targetType.isAssignableFrom(String.class); 13 | } 14 | 15 | @Override 16 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 17 | return Collections.singleton(Arbitraries.strings().numeric().ofLength(2)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/domains/Doubled.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.domains; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.PARAMETER}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @interface Doubled {} 8 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/domains/MakeNegative.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.domains; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target({ElementType.PARAMETER}) 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @interface MakeNegative {} 8 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/api/edgeCases/GenericEdgeCasesProperties.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.api.edgeCases; 2 | 3 | import net.jqwik.api.*; 4 | 5 | import static org.assertj.core.api.Assertions.*; 6 | 7 | public interface GenericEdgeCasesProperties { 8 | 9 | @Provide 10 | Arbitrary> arbitraries(); 11 | 12 | @Property 13 | default void askingForZeroEdgeCases(@ForAll("arbitraries") Arbitrary arbitrary) { 14 | assertThat(arbitrary.edgeCases(0)).hasSize(0); 15 | } 16 | 17 | @Property 18 | default void askingForNegativeNumberOfEdgeCases(@ForAll("arbitraries") Arbitrary arbitrary) { 19 | assertThat(arbitrary.edgeCases(-42)).hasSize(0); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/execution/MockPipeline.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.engine.execution.pipeline.*; 6 | 7 | public class MockPipeline implements Pipeline { 8 | private List tasks = new ArrayList<>(); 9 | 10 | @Override 11 | public void submit(ExecutionTask task, ExecutionTask... predecessors) { 12 | tasks.add(task); 13 | } 14 | 15 | void runWith(PropertyExecutionListener listener) { 16 | TaskExecutionResult executionResult = TaskExecutionResult.success(); 17 | for (ExecutionTask task : tasks) { 18 | executionResult = task.execute(listener, executionResult); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/execution/reporting/LineReporterStub.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.execution.reporting; 2 | 3 | import java.util.*; 4 | 5 | public class LineReporterStub implements LineReporter { 6 | 7 | final List lines = new ArrayList<>(); 8 | 9 | @Override 10 | public void addLine(int indentLevel, String line) { 11 | String indentation = LineReporter.multiply(' ', indentLevel * 2); 12 | this.lines.add(indentation + line.trim()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/IsClassDescriptorFor.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import org.mockito.*; 4 | 5 | import net.jqwik.engine.descriptor.*; 6 | 7 | class IsClassDescriptorFor implements ArgumentMatcher { 8 | 9 | private final Class containerClass; 10 | 11 | IsClassDescriptorFor(Class containerClass) { 12 | this.containerClass = containerClass; 13 | } 14 | 15 | @Override 16 | public boolean matches(ContainerClassDescriptor descriptor) { 17 | return descriptor.getContainerClass() == containerClass; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/IsPropertyExecutionResultFailure.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import org.mockito.*; 4 | 5 | import net.jqwik.api.lifecycle.*; 6 | 7 | class IsPropertyExecutionResultFailure implements ArgumentMatcher { 8 | private final String message; 9 | 10 | IsPropertyExecutionResultFailure(String message) { 11 | this.message = message; 12 | } 13 | 14 | @Override 15 | public boolean matches(PropertyExecutionResult result) { 16 | if (result.status() != PropertyExecutionResult.Status.FAILED) 17 | return false; 18 | if (message == null) 19 | return true; 20 | return result.throwable().get().getMessage().equals(message); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/IsTestResultFailure.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import org.junit.platform.engine.*; 4 | import org.mockito.*; 5 | 6 | class IsTestResultFailure implements ArgumentMatcher { 7 | private final String message; 8 | 9 | IsTestResultFailure(String message) { 10 | this.message = message; 11 | } 12 | 13 | @Override 14 | public boolean matches(TestExecutionResult result) { 15 | if (result.getStatus() != TestExecutionResult.Status.FAILED) 16 | return false; 17 | if (message == null) 18 | return true; 19 | return result.getThrowable().get().getMessage().equals(message); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/PropertyExecutionResultMatchers.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import net.jqwik.api.lifecycle.*; 4 | 5 | import static org.mockito.ArgumentMatchers.*; 6 | 7 | public class PropertyExecutionResultMatchers { 8 | 9 | public static PropertyExecutionResult isSuccessful() { 10 | return argThat(argument -> argument.status() == PropertyExecutionResult.Status.SUCCESSFUL); 11 | } 12 | 13 | public static PropertyExecutionResult isFailed(String message) { 14 | return argThat(new IsPropertyExecutionResultFailure(message)); 15 | } 16 | 17 | public static PropertyExecutionResult isFailed() { 18 | return isFailed(null); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/TestDescriptorMatchers.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import net.jqwik.engine.descriptor.*; 4 | 5 | import static org.mockito.ArgumentMatchers.*; 6 | 7 | public class TestDescriptorMatchers { 8 | 9 | public static ContainerClassDescriptor isClassDescriptorFor(Class containerClass) { 10 | return argThat(new IsClassDescriptorFor(containerClass)); 11 | } 12 | 13 | public static PropertyMethodDescriptor isPropertyDescriptorFor(Class containerClass, String methodName) { 14 | return argThat(new IsPropertyDescriptorFor(containerClass, methodName)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /engine/src/test/java/net/jqwik/engine/matchers/TestExecutionResultMatchers.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.engine.matchers; 2 | 3 | import org.junit.platform.engine.*; 4 | 5 | import static org.mockito.ArgumentMatchers.*; 6 | 7 | public class TestExecutionResultMatchers { 8 | 9 | public static TestExecutionResult isSuccessful() { 10 | return eq(TestExecutionResult.successful()); 11 | } 12 | 13 | public static TestExecutionResult isFailed(String message) { 14 | return argThat(new IsTestResultFailure(message)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /experiments/Fixture.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | @Retention(RetentionPolicy.RUNTIME) 4 | public @interface Fixture { 5 | String referBy() default ""; 6 | 7 | Class[] dependsOn() default { }; 8 | } 9 | -------------------------------------------------------------------------------- /experiments/ForAllLifeCycle.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | public interface ForAllLifeCycle { 4 | 5 | default void beforeAll() { 6 | } 7 | 8 | default void afterAll() { 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /experiments/ForEachLifeCycle.java: -------------------------------------------------------------------------------- 1 | 2 | package experiments; 3 | 4 | public interface ForEachLifeCycle { 5 | 6 | default void beforeEach() { 7 | } 8 | 9 | default void afterEach() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /experiments/SimpleSpec.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | @Spec("A simple Specification") 4 | public class SimpleSpec implements ForEachLifeCycle { 5 | 6 | @Override 7 | public void beforeEach() { 8 | System.out.println("before each"); 9 | } 10 | 11 | @Override 12 | public void afterEach() { 13 | System.out.println("after each"); 14 | } 15 | 16 | @Fact("A String is a String") 17 | boolean aStringIsAString() { 18 | return "aString" instanceof String; 19 | } 20 | 21 | @Fact 22 | boolean aNameIsAString(Object aName, Object other) { 23 | return aName instanceof String; 24 | } 25 | 26 | @Fixture 27 | Object aName() { 28 | return "Johannes"; 29 | } 30 | 31 | @Fixture(referBy = "other") 32 | Object otherName() { 33 | return "Marcus"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /experiments/Spec.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | @Retention(RetentionPolicy.RUNTIME) 4 | public @interface Spec { 5 | String value() default ""; 6 | } 7 | -------------------------------------------------------------------------------- /experiments/SpecPlugin.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | public interface SpecPlugin { 4 | } 5 | -------------------------------------------------------------------------------- /experiments/UsePlugIn.java: -------------------------------------------------------------------------------- 1 | package experiments; 2 | 3 | public @interface UsePlugIn { 4 | Class value(); 5 | } 6 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # com.github.vlsi.gradle-extensions prints only failing or slow test results 2 | slowTestLogThreshold=15000 3 | slowSuiteLogThreshold=30000 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jqwik-team/jqwik/4a2db008aaca36448ccd2b980cc86861a33b985c/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /jqwik-images.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jqwik-team/jqwik/4a2db008aaca36448ccd2b980cc86861a33b985c/jqwik-images.key -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/api/BuildersExtensions.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.api 2 | 3 | import net.jqwik.api.Arbitrary 4 | import net.jqwik.api.Builders.BuilderCombinator 5 | import org.apiguardian.api.API 6 | import java.util.function.BiFunction 7 | 8 | /** 9 | * Convenience function for Kotlin to not use backticked `in` function. 10 | */ 11 | @API(status = API.Status.EXPERIMENTAL, since = "1.6.0") 12 | fun BuilderCombinator.use(arbitrary: Arbitrary, combinator: (B, T) -> B): BuilderCombinator 13 | where B : Any { 14 | return this.use(arbitrary).`in`(combinator) 15 | } 16 | -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/api/CollectionExtensions.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.api 2 | 3 | import net.jqwik.api.Arbitraries 4 | import net.jqwik.api.Arbitrary 5 | import net.jqwik.api.arbitraries.SetArbitrary 6 | import org.apiguardian.api.API 7 | 8 | /** 9 | * Convenience function to replace Arbitraries.subsetOf(..) 10 | */ 11 | @API(status = API.Status.EXPERIMENTAL, since = "1.6.5") 12 | fun Collection.anySubset(): SetArbitrary = Arbitraries.subsetOf(this) 13 | 14 | /** 15 | * Convenience function to replace Arbitraries.of(..) 16 | */ 17 | @API(status = API.Status.EXPERIMENTAL, since = "1.7.1") 18 | fun Collection.anyValue(): Arbitrary = Arbitraries.of(this) 19 | -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/api/StringArbitraryExtensions.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.api 2 | 3 | import net.jqwik.api.arbitraries.StringArbitrary 4 | import org.apiguardian.api.API 5 | 6 | /** 7 | * Set the minimum and maximum allowed length of generated strings. 8 | */ 9 | @API(status = API.Status.EXPERIMENTAL, since = "1.6.0") 10 | fun StringArbitrary.ofLength(range: IntRange): StringArbitrary = ofMinLength(range.first).ofMaxLength(range.last) -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/api/TypeAliases.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.api 2 | 3 | typealias JqwikCharRange = net.jqwik.api.constraints.CharRange 4 | typealias JqwikShortRange = net.jqwik.api.constraints.ShortRange 5 | typealias JqwikIntRange = net.jqwik.api.constraints.IntRange 6 | typealias JqwikLongRange = net.jqwik.api.constraints.LongRange 7 | 8 | -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/api/TypeUsageExtensions.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.api 2 | 3 | import net.jqwik.api.providers.TypeUsage 4 | import org.apiguardian.api.API 5 | import kotlin.reflect.KClass 6 | import kotlin.reflect.KType 7 | import kotlin.reflect.jvm.jvmName 8 | 9 | internal val kTypeMetaInfoKey: String = KType::class.jvmName 10 | 11 | val TypeUsage.kotlinType: KType? 12 | get() { 13 | val metaInfo = this.getMetaInfo(kTypeMetaInfoKey) 14 | return if (metaInfo.isPresent) metaInfo.get() as KType else null 15 | } 16 | 17 | @API(status = API.Status.EXPERIMENTAL, since = "1.6.0") 18 | fun TypeUsage.isAssignableFrom(kClass: KClass<*>) : Boolean = isAssignableFrom(kClass.java) -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/DefaultConstructorMarkerProvider.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.Arbitraries 4 | import net.jqwik.api.Arbitrary 5 | import net.jqwik.api.providers.ArbitraryProvider 6 | import net.jqwik.api.providers.TypeUsage 7 | import kotlin.jvm.internal.DefaultConstructorMarker 8 | 9 | class DefaultConstructorMarkerProvider: ArbitraryProvider { 10 | 11 | override fun canProvideFor(targetType: TypeUsage) = targetType.isOfType(DefaultConstructorMarker::class.java) 12 | 13 | override fun provideFor( 14 | targetType: TypeUsage, 15 | subtypeProvider: ArbitraryProvider.SubtypeProvider 16 | ): MutableSet> { 17 | return mutableSetOf(Arbitraries.nothing()) 18 | } 19 | } -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/IntRangeArbitraryProvider.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.Arbitrary 4 | import net.jqwik.api.providers.ArbitraryProvider 5 | import net.jqwik.api.providers.TypeUsage 6 | import net.jqwik.kotlin.api.IntRangeArbitrary 7 | 8 | class IntRangeArbitraryProvider: ArbitraryProvider { 9 | 10 | override fun canProvideFor(targetType: TypeUsage) = targetType.isOfType(IntRange::class.java) 11 | 12 | override fun provideFor( 13 | targetType: TypeUsage, 14 | subtypeProvider: ArbitraryProvider.SubtypeProvider 15 | ): MutableSet> { 16 | return mutableSetOf(IntRangeArbitrary()) 17 | } 18 | } -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/KTypeEnhancer.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.providers.TypeUsage 4 | import net.jqwik.kotlin.api.kTypeMetaInfoKey 5 | import java.lang.reflect.Parameter 6 | import kotlin.reflect.KParameter 7 | 8 | class KTypeEnhancer : TypeUsage.Enhancer { 9 | 10 | override fun forParameter(original: TypeUsage, parameter: Parameter): TypeUsage { 11 | val kParameter: KParameter? = parameter.kotlinParameter 12 | return kParameter?.let { original.withMetaInfo(kTypeMetaInfoKey, it.type) } ?: original 13 | } 14 | } -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/NullabilityEnhancer.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.providers.TypeUsage 4 | import net.jqwik.kotlin.api.kotlinType 5 | import java.lang.reflect.Parameter 6 | 7 | // Requires KTypeEnhancer to have run before 8 | class NullabilityEnhancer : TypeUsage.Enhancer { 9 | 10 | override fun forParameter(original: TypeUsage, parameter: Parameter): TypeUsage { 11 | //val kParameter: KParameter? = parameter.kotlinParameter 12 | //val isNullable: Boolean = kParameter?.isMarkedNullable ?: false 13 | val isNullable = original.kotlinType?.isMarkedNullable ?: false 14 | return if (isNullable) original.asNullable() else original 15 | } 16 | } -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/PairReportingFormat.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.SampleReportingFormat 4 | import net.jqwik.api.Tuple 5 | 6 | class PairReportingFormat : SampleReportingFormat { 7 | 8 | override fun appliesTo(value: Any): Boolean { 9 | return value is Pair<*, *> 10 | } 11 | 12 | @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") 13 | override fun report(value: Any): Any { 14 | val pair = value as Pair<*, *> 15 | return Tuple.of(pair.first, pair.second) 16 | } 17 | } -------------------------------------------------------------------------------- /kotlin/src/main/kotlin/net/jqwik/kotlin/internal/TripleReportingFormat.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.internal 2 | 3 | import net.jqwik.api.SampleReportingFormat 4 | import net.jqwik.api.Tuple 5 | 6 | class TripleReportingFormat : SampleReportingFormat { 7 | 8 | override fun appliesTo(value: Any): Boolean { 9 | return value is Triple<*, *, *> 10 | } 11 | 12 | @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") 13 | override fun report(value: Any): Any { 14 | val triple = value as Triple<*, *, *> 15 | return Tuple.of(triple.first, triple.second, triple.third) 16 | } 17 | } -------------------------------------------------------------------------------- /kotlin/src/main/resources/META-INF/services/net.jqwik.api.SampleReportingFormat: -------------------------------------------------------------------------------- 1 | net.jqwik.kotlin.internal.PairReportingFormat 2 | net.jqwik.kotlin.internal.TripleReportingFormat 3 | -------------------------------------------------------------------------------- /kotlin/src/main/resources/META-INF/services/net.jqwik.api.configurators.ArbitraryConfigurator: -------------------------------------------------------------------------------- 1 | net.jqwik.kotlin.internal.KotlinIntRangeConfigurator 2 | net.jqwik.kotlin.internal.KotlinUniqueElementsConfigurator -------------------------------------------------------------------------------- /kotlin/src/main/resources/META-INF/services/net.jqwik.api.lifecycle.LifecycleHook: -------------------------------------------------------------------------------- 1 | net.jqwik.kotlin.internal.SuspendedPropertyMethodsHook 2 | net.jqwik.kotlin.internal.ObjectAsContainerClassHook -------------------------------------------------------------------------------- /kotlin/src/main/resources/META-INF/services/net.jqwik.api.providers.ArbitraryProvider: -------------------------------------------------------------------------------- 1 | net.jqwik.kotlin.internal.IntRangeArbitraryProvider 2 | net.jqwik.kotlin.internal.SequenceArbitraryProvider 3 | net.jqwik.kotlin.internal.PairArbitraryProvider 4 | net.jqwik.kotlin.internal.TripleArbitraryProvider 5 | net.jqwik.kotlin.internal.DefaultConstructorMarkerProvider 6 | -------------------------------------------------------------------------------- /kotlin/src/main/resources/META-INF/services/net.jqwik.api.providers.TypeUsage$Enhancer: -------------------------------------------------------------------------------- 1 | net.jqwik.kotlin.internal.KTypeEnhancer 2 | net.jqwik.kotlin.internal.NullabilityEnhancer 3 | net.jqwik.kotlin.internal.ParameterAnnotationEnhancer 4 | -------------------------------------------------------------------------------- /kotlin/src/test/java/net/jqwik/kotlin/java/JavaProperty.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin.java; 2 | 3 | import net.jqwik.api.*; 4 | 5 | class JavaProperty { 6 | 7 | @Property 8 | void aProperty(@ForAll int anInt) { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /kotlin/src/test/kotlin/net/jqwik/kotlin/StringArbitraryExtensionsTests.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin 2 | 3 | import net.jqwik.api.Example 4 | import net.jqwik.api.ForAll 5 | import net.jqwik.api.arbitraries.StringArbitrary 6 | import net.jqwik.kotlin.api.any 7 | import net.jqwik.kotlin.api.ofLength 8 | import net.jqwik.testing.TestingSupport.checkAllGenerated 9 | import java.util.* 10 | 11 | class StringArbitraryExtensionsTests { 12 | 13 | @Example 14 | fun `StringArbitrary ofLength() with range`(@ForAll random: Random) { 15 | val stringArbitrary: StringArbitrary = String.any().ofLength(2..12) 16 | checkAllGenerated(stringArbitrary, random) { string -> string.length in 2..12 } 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /kotlin/src/test/kotlin/net/jqwik/kotlin/TypeUsageExtensionsTests.kt: -------------------------------------------------------------------------------- 1 | package net.jqwik.kotlin 2 | 3 | import net.jqwik.api.* 4 | import net.jqwik.api.providers.TypeUsage 5 | import net.jqwik.kotlin.api.kotlinType 6 | 7 | class TypeUsageExtensionsTests { 8 | 9 | @Example 10 | fun kTypeIsAddedToTypeUsageOnTopLevel(@ForAll("ints") anInt: Int) { 11 | assert(anInt == 42) 12 | } 13 | 14 | @Provide 15 | fun ints(type: TypeUsage): Arbitrary { 16 | assert(type.kotlinType != null) 17 | return Arbitraries.just(42) 18 | } 19 | } -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include(':base') 2 | include(':api') 3 | include(':engine') 4 | include(':time') 5 | include(':web') 6 | include(':kotlin') 7 | include(':testing') 8 | include(':documentation') 9 | include(':test-modular-api') -------------------------------------------------------------------------------- /test-modular-api/src/test/java/module-info.java: -------------------------------------------------------------------------------- 1 | open module test.modular.api { 2 | requires org.apiguardian.api; 3 | requires net.jqwik.api; 4 | requires net.jqwik.web; 5 | } 6 | -------------------------------------------------------------------------------- /test-modular-api/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | #jqwik.database=.jqwik-database 2 | #jqwik.failures.runfirst=false 3 | #jqwik.tries.default=1000 4 | #jqwik.maxdiscardratio.default=5 5 | #jqwik.reporting.usejunitplatform=false 6 | #jqwik.generation.default=AUTO 7 | #jqwik.failures.after.default=SAMPLE_FIRST 8 | jqwik.reporting.onlyfailures=true 9 | #jqwik.edgecases.default=MIXIN 10 | #jqwik.shrinking.default=BOUNDED 11 | #jqwik.shrinking.bounded.seconds=20 -------------------------------------------------------------------------------- /testing/src/main/module/module-info.java: -------------------------------------------------------------------------------- 1 | module net.jqwik.testing { 2 | 3 | exports net.jqwik.testing; 4 | 5 | requires transitive net.jqwik.api; 6 | requires org.opentest4j; 7 | } 8 | -------------------------------------------------------------------------------- /testing/src/main/resources/archunit.properties: -------------------------------------------------------------------------------- 1 | archRule.failOnEmptyShould = false -------------------------------------------------------------------------------- /testing/src/main/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | #jqwik.database=.jqwik-database 2 | #jqwik.failures.runfirst=false 3 | #jqwik.tries.default=1000 4 | #jqwik.maxdiscardratio.default=5 5 | #jqwik.reporting.usejunitplatform=false 6 | #jqwik.generation.default=AUTO 7 | #jqwik.failures.after.default=SAMPLE_FIRST 8 | jqwik.reporting.onlyfailures=true 9 | #jqwik.edgecases.default=MIXIN 10 | #jqwik.shrinking.default=BOUNDED 11 | jqwik.shrinking.bounded.seconds=20 -------------------------------------------------------------------------------- /testing/src/main/resources/log4j2-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/arbitraries/PeriodArbitrary.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.arbitraries; 2 | 3 | import java.time.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import net.jqwik.api.*; 8 | 9 | import static org.apiguardian.api.API.Status.*; 10 | 11 | /** 12 | * Fluent interface to configure the generation of period values. 13 | */ 14 | @API(status = EXPERIMENTAL, since = "1.4.0") 15 | public interface PeriodArbitrary extends Arbitrary { 16 | 17 | /** 18 | * Set the allowed lower {@code min} (included) and upper {@code max} (included) bounder of generated period. 19 | */ 20 | PeriodArbitrary between(Period min, Period max); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/arbitraries/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.time.api.arbitraries; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/constraints/OffsetRange.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the range of generated periods. 11 | *

12 | * Applies to OffsetDateTime, ZoneOffset and OffsetTime parameters which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | */ 16 | @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | @API(status = EXPERIMENTAL, since = "1.5.1") 20 | public @interface OffsetRange { 21 | String min() default "-12:00:00"; 22 | 23 | String max() default "+14:00:00"; 24 | } 25 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/constraints/PeriodRange.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.constraints; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain the range of generated periods. 11 | *

12 | * Applies to parameters of type {@linkplain java.time.Period} which are also annotated with {@code @ForAll}. 13 | * 14 | * @see net.jqwik.api.ForAll 15 | */ 16 | @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | @API(status = EXPERIMENTAL, since = "1.4.0") 20 | public @interface PeriodRange { 21 | String min() default "P-1000Y"; 22 | 23 | String max() default "P1000Y"; 24 | } 25 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/constraints/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.time.api.constraints; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/api/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.time.api; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/AllowedDayOfWeeks.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | public class AllowedDayOfWeeks extends AllowedUnits { 7 | 8 | @Override 9 | protected void setDefaultAllowed() { 10 | allowed = new LinkedHashSet<>(Arrays.asList(DayOfWeek.values())); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/AllowedMonths.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | import java.util.stream.*; 6 | 7 | import net.jqwik.api.support.*; 8 | 9 | public class AllowedMonths extends AllowedUnits { 10 | 11 | @Override 12 | protected void setDefaultAllowed() { 13 | allowed = new LinkedHashSet<>(Arrays.asList(Month.values())); 14 | } 15 | 16 | public void set(MonthBetween monthBetween) { 17 | allowed = Arrays.stream(Month.values()) 18 | .filter(m -> m.compareTo(monthBetween.getMin()) >= 0 && m.compareTo(monthBetween.getMax()) <= 0) 19 | .collect(CollectorsSupport.toLinkedHashSet()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/AllowedUnits.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.util.*; 4 | 5 | // TODO: Make it immutable 6 | public abstract class AllowedUnits { 7 | 8 | protected Set allowed; 9 | 10 | public AllowedUnits() { 11 | setDefaultAllowed(); 12 | } 13 | 14 | protected abstract void setDefaultAllowed(); 15 | 16 | @SafeVarargs 17 | public final void set(T... values) { 18 | allowed = new LinkedHashSet<>(Arrays.asList(values)); 19 | } 20 | 21 | public Set get() { 22 | return allowed; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/DayOfMonthBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | public class DayOfMonthBetween extends Between { 4 | @Override 5 | public DayOfMonthBetween set(Integer min, Integer max) { 6 | min = Math.max(1, Math.min(31, min)); 7 | max = Math.max(1, Math.min(31, max)); 8 | return (DayOfMonthBetween) super.set(min, max); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/DurationBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class DurationBetween extends Between { 6 | } 7 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/HourBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | public class HourBetween extends Between { 4 | @Override 5 | protected void checkValidity(Integer min, Integer max) { 6 | if ((min != null && min < 0) || (max != null && max > 23)) { 7 | throw new IllegalArgumentException("Hour value must be between 0 and 23."); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/LocalDateBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class LocalDateBetween extends Between { 6 | 7 | @Override 8 | protected void checkValidity(LocalDate min, LocalDate max) { 9 | if ((min != null && min.getYear() <= 0) || (max != null && max.getYear() <= 0)) { 10 | throw new IllegalArgumentException("Minimum year in a date must be > 0"); 11 | } 12 | } 13 | 14 | public void setYearBetween(YearBetween yearBetween) { 15 | LocalDate min = LocalDate.of(yearBetween.getMin().getValue(), 1, 1); 16 | LocalDate max = LocalDate.of(yearBetween.getMax().getValue(), 12, 31); 17 | set(min, max); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/LocalDateTimeBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class LocalDateTimeBetween extends Between { 6 | @Override 7 | protected void checkValidity(LocalDateTime min, LocalDateTime max) { 8 | if ((min != null && min.getYear() <= 0) || (max != null && max.getYear() <= 0)) { 9 | throw new IllegalArgumentException("Minimum year in a date time must be > 0"); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/LocalTimeBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class LocalTimeBetween extends Between { 6 | } 7 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/MinuteBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | public class MinuteBetween extends Between { 4 | @Override 5 | protected void checkValidity(Integer min, Integer max) { 6 | if ((min != null && min < 0) || (max != null && max > 59)) { 7 | throw new IllegalArgumentException("Minute value must be between 0 and 59."); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/MonthBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class MonthBetween extends Between { 6 | } 7 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/PeriodBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class PeriodBetween extends Between { 6 | 7 | public final static long DAYS_PER_MONTH = 31L; // The maximum 8 | public final static long DAYS_PER_YEAR = 372L; // 31 * 12 9 | 10 | public static long inDays(Period period) { 11 | return period.getYears() * DAYS_PER_YEAR + period.getMonths() * DAYS_PER_MONTH + period.getDays(); 12 | } 13 | 14 | @Override 15 | protected boolean minIsBeforeMax(Period min, Period max) { 16 | return inDays(min) <= inDays(max); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/SecondBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | public class SecondBetween extends Between { 4 | @Override 5 | protected void checkValidity(Integer min, Integer max) { 6 | if ((min != null && min < 0) || (max != null && max > 59)) { 7 | throw new IllegalArgumentException("Second value must be between 0 and 59."); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/YearMonthBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class YearMonthBetween extends Between { 6 | 7 | @Override 8 | protected void checkValidity(YearMonth min, YearMonth max) { 9 | if ((min != null && min.getYear() <= 0) || (max != null && max.getYear() <= 0)) { 10 | throw new IllegalArgumentException("Minimum year in a year month must be > 0"); 11 | } 12 | } 13 | 14 | public void setYearBetween(YearBetween yearBetween) { 15 | YearMonth min = YearMonth.of(yearBetween.getMin().getValue(), 1); 16 | YearMonth max = YearMonth.of(yearBetween.getMax().getValue(), 12); 17 | set(min, max); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/arbitraries/valueRanges/ZoneOffsetBetween.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.arbitraries.valueRanges; 2 | 3 | import java.time.*; 4 | 5 | public class ZoneOffsetBetween extends Between { 6 | } 7 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/DateTimeArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class DateTimeArbitraryProvider implements ArbitraryProvider { 11 | 12 | @Override 13 | public boolean canProvideFor(TypeUsage targetType) { 14 | return targetType.isAssignableFrom(LocalDateTime.class); 15 | } 16 | 17 | @Override 18 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 19 | return Collections.singleton(DateTimes.dateTimes()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/DurationArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class DurationArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(Duration.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Times.durations()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/InstantArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class InstantArbitraryProvider implements ArbitraryProvider { 11 | 12 | @Override 13 | public boolean canProvideFor(TypeUsage targetType) { 14 | return targetType.isAssignableFrom(Instant.class); 15 | } 16 | 17 | @Override 18 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 19 | return Collections.singleton(DateTimes.instants()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/LocalDateArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class LocalDateArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(LocalDate.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Dates.dates()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/MonthDayArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class MonthDayArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(MonthDay.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Dates.monthDays()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/OffsetDateTimeArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class OffsetDateTimeArbitraryProvider implements ArbitraryProvider { 11 | 12 | @Override 13 | public boolean canProvideFor(TypeUsage targetType) { 14 | return targetType.isAssignableFrom(OffsetDateTime.class); 15 | } 16 | 17 | @Override 18 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 19 | return Collections.singleton(DateTimes.offsetDateTimes()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/OffsetTimeArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class OffsetTimeArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(OffsetTime.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Times.offsetTimes()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/PeriodArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class PeriodArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(Period.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Dates.periods()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/TimeArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class TimeArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(LocalTime.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Times.times()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/TimeZoneArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | import net.jqwik.time.api.*; 8 | 9 | public class TimeZoneArbitraryProvider implements ArbitraryProvider { 10 | @Override 11 | public boolean canProvideFor(TypeUsage targetType) { 12 | return targetType.isAssignableFrom(TimeZone.class); 13 | } 14 | 15 | @Override 16 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 17 | return Collections.singleton(Times.timeZones()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/YearArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class YearArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(Year.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Dates.years()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/YearMonthArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class YearMonthArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(YearMonth.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Dates.yearMonths()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/ZoneIdArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class ZoneIdArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(ZoneId.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Times.zoneIds()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/ZoneOffsetsArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class ZoneOffsetsArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(ZoneOffset.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(Times.zoneOffsets()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/main/java/net/jqwik/time/internal/properties/providers/ZonedDateTimeArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.internal.properties.providers; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.api.providers.*; 8 | import net.jqwik.time.api.*; 9 | 10 | public class ZonedDateTimeArbitraryProvider implements ArbitraryProvider { 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(ZonedDateTime.class); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.singleton(DateTimes.zonedDateTimes()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/instant/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.instant; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validInstantIsGenerated(@ForAll Instant instant) { 13 | assertThat(instant).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/instant/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.instant; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary instants() { 14 | return DateTimes.instants(); 15 | } 16 | 17 | @Property 18 | void validInstantIsGenerated(@ForAll("instants") Instant instant) { 19 | assertThat(instant).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/instant/constraint/InvalidUseOfContraintsTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.instant.constraint; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.time.api.constraints.*; 5 | 6 | import static org.assertj.core.api.Assertions.*; 7 | 8 | public class InvalidUseOfContraintsTests { 9 | 10 | @Property 11 | void instantRange(@ForAll @InstantRange(min = "2013-05-25T01:32:21.113943Z", max = "2020-08-23T01:32:21.113943Z") Integer i) { 12 | assertThat(i).isNotNull(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/localDateTime/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.localDateTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validLocalDateTimeIsGenerated(@ForAll LocalDateTime dateTime) { 13 | assertThat(dateTime).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/localDateTime/constraint/InvalidUseOfContraintsTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.localDateTime.constraint; 2 | 3 | import net.jqwik.api.*; 4 | import net.jqwik.time.api.constraints.*; 5 | 6 | import static org.assertj.core.api.Assertions.*; 7 | 8 | public class InvalidUseOfContraintsTests { 9 | 10 | @Property 11 | void dateTimeRange(@ForAll @DateTimeRange(min = "2013-05-25T01:32:21.113943", max = "2020-08-23T01:32:21.113943") String string) { 12 | assertThat(string).isNotNull(); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/offsetDateTime/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.offsetDateTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validOffsetDateTimeIsGenerated(@ForAll OffsetDateTime dateTime) { 13 | assertThat(dateTime).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/offsetDateTime/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.offsetDateTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary offsetDateTimes() { 14 | return DateTimes.offsetDateTimes(); 15 | } 16 | 17 | @Property 18 | void validOffsetDateTimeIsGenerated(@ForAll("offsetDateTimes") OffsetDateTime offsetDateTime) { 19 | assertThat(offsetDateTime).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/zonedDateTime/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.zonedDateTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | @PropertyDefaults(tries = 100) 10 | public class DefaultGenerationTests { 11 | 12 | @Property 13 | void validOffsetDateTimeIsGenerated(@ForAll ZonedDateTime dateTime) { 14 | assertThat(dateTime).isNotNull(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dateTimes/zonedDateTime/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dateTimes.zonedDateTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary zonedDateTimes() { 14 | return DateTimes.zonedDateTimes(); 15 | } 16 | 17 | @Property 18 | void validZonedDateTimeIsGenerated(@ForAll("zonedDateTimes") ZonedDateTime zonedDateTime) { 19 | assertThat(zonedDateTime).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/calendar/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.calendar; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary dates() { 14 | return Dates.datesAsCalendar(); 15 | } 16 | 17 | @Property 18 | void validCalendarIsGenerated(@ForAll("dates") Calendar calendar) { 19 | assertThat(calendar).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/date/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.date; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary dates() { 14 | return Dates.datesAsDate(); 15 | } 16 | 17 | @Property 18 | void validDateIsGenerated(@ForAll("dates") Date date) { 19 | assertThat(date).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/monthDay/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.monthDay; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validMonthDayIsGenerated(@ForAll MonthDay monthDay) { 13 | assertThat(monthDay).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/monthDay/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.monthDay; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary monthDays() { 14 | return Dates.monthDays(); 15 | } 16 | 17 | @Property 18 | void validMonthDayIsGenerated(@ForAll("monthDays") MonthDay monthDay) { 19 | assertThat(monthDay).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/period/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.period; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validPeriodIsGenerated(@ForAll Period period) { 13 | assertThat(period).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/year/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.year; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void yearIsNotNull(@ForAll Year year) { 13 | assertThat((Object) year).isNotNull(); 14 | } 15 | 16 | @Property 17 | void defaultYearGenerationYearsOnlyBetween1900And2500(@ForAll Year year) { 18 | assertThat(year.getValue()).isGreaterThanOrEqualTo(1900); 19 | assertThat(year.getValue()).isLessThanOrEqualTo(2500); 20 | } 21 | 22 | @Property 23 | void yearIsNotZero(@ForAll Year year) { 24 | assertThat((Object) year).isNotEqualTo(Year.of(0)); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/yearMonth/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.yearMonth; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validYearMonthIsGenerated(@ForAll YearMonth yearMonth) { 13 | assertThat(yearMonth).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/dates/yearMonth/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.dates.yearMonth; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary yearMonths() { 14 | return Dates.yearMonths(); 15 | } 16 | 17 | @Property 18 | void validYearMonthIsGenerated(@ForAll("yearMonths") YearMonth yearMonth) { 19 | assertThat(yearMonth).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/testingSupport/ForCalendar.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.testingSupport; 2 | 3 | import java.util.*; 4 | 5 | public class ForCalendar { 6 | 7 | public static Calendar getCalendar(int year, int month, int day) { 8 | Calendar calendar = Calendar.getInstance(); 9 | calendar.set(year, month, day, 0, 0, 0); 10 | calendar.set(Calendar.MILLISECOND, 0); 11 | return calendar; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/testingSupport/ForDate.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.testingSupport; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.time.internal.properties.arbitraries.*; 6 | 7 | import static net.jqwik.time.api.testingSupport.ForCalendar.*; 8 | 9 | public class ForDate { 10 | 11 | public static Calendar dateToCalendar(Date date) { 12 | return DefaultDateArbitrary.dateToCalendar(date); 13 | } 14 | 15 | public static Date getDate(int year, int month, int day) { 16 | return getCalendar(year, month, day).getTime(); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/testingSupport/ForDuration.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.testingSupport; 2 | 3 | import java.time.*; 4 | 5 | public class ForDuration { 6 | 7 | public static int getSecond(Duration d) { 8 | return (int) (d.getSeconds() % 60); 9 | } 10 | 11 | public static int getMinute(Duration d) { 12 | return (int) ((d.getSeconds() % 3600) / 60); 13 | } 14 | 15 | public static long getHour(Duration d) { 16 | return d.getSeconds() / 3600; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/duration/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.duration; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validDurationIsGenerated(@ForAll Duration duration) { 13 | assertThat(duration).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/localTime/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.localTime; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class DefaultGenerationTests { 11 | 12 | @Property 13 | void validLocalTimeIsGenerated(@ForAll LocalTime time) { 14 | assertThat(time).isNotNull(); 15 | } 16 | 17 | @Property 18 | void validZoneIdIsGenerated(@ForAll ZoneId zoneId) { 19 | assertThat(zoneId).isNotNull(); 20 | } 21 | 22 | @Property 23 | void validTimeZoneIsGenerated(@ForAll TimeZone timeZone) { 24 | assertThat(timeZone).isNotNull(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/offsetTime/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.offsetTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validOffsetTimeIsGenerated(@ForAll OffsetTime time) { 13 | assertThat(time).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/offsetTime/ShrinkingTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.offsetTime; 2 | 3 | import java.time.*; 4 | import java.util.*; 5 | 6 | import net.jqwik.api.*; 7 | import net.jqwik.time.api.*; 8 | import net.jqwik.time.api.arbitraries.*; 9 | 10 | import static org.assertj.core.api.Assertions.*; 11 | 12 | import static net.jqwik.testing.ShrinkingSupport.*; 13 | 14 | @PropertyDefaults(tries = 100) 15 | public class ShrinkingTests { 16 | 17 | @Property 18 | void defaultShrinking(@ForAll Random random) { 19 | OffsetTimeArbitrary times = Times.offsetTimes(); 20 | OffsetTime value = falsifyThenShrink(times, random); 21 | assertThat(value).isEqualTo(OffsetTime.of(LocalTime.of(0, 0, 0), ZoneOffset.of("Z"))); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/offsetTime/SimpleArbitrariesTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.offsetTime; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.time.api.*; 7 | 8 | import static org.assertj.core.api.Assertions.*; 9 | 10 | public class SimpleArbitrariesTests { 11 | 12 | @Provide 13 | Arbitrary times() { 14 | return Times.offsetTimes(); 15 | } 16 | 17 | @Property 18 | void validOffsetTimeIsGenerated(@ForAll("times") OffsetTime time) { 19 | assertThat(time).isNotNull(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /time/src/test/java/net/jqwik/time/api/times/zoneOffset/DefaultGenerationTests.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.time.api.times.zoneOffset; 2 | 3 | import java.time.*; 4 | 5 | import net.jqwik.api.*; 6 | 7 | import static org.assertj.core.api.Assertions.*; 8 | 9 | public class DefaultGenerationTests { 10 | 11 | @Property 12 | void validZoneOffsetIsGenerated(@ForAll ZoneOffset offset) { 13 | assertThat(offset).isNotNull(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /web/src/main/java/net/jqwik/web/WebDomainArbitraryProvider.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.web; 2 | 3 | import java.util.*; 4 | 5 | import net.jqwik.api.*; 6 | import net.jqwik.api.providers.*; 7 | import net.jqwik.web.api.*; 8 | 9 | public class WebDomainArbitraryProvider implements ArbitraryProvider { 10 | 11 | @Override 12 | public boolean canProvideFor(TypeUsage targetType) { 13 | return targetType.isAssignableFrom(String.class) && targetType.findAnnotation(WebDomain.class).isPresent(); 14 | } 15 | 16 | @Override 17 | public Set> provideFor(TypeUsage targetType, SubtypeProvider subtypeProvider) { 18 | return Collections.>singleton(Web.webDomains()); 19 | } 20 | 21 | @Override 22 | public int priority() { 23 | return 5; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /web/src/main/java/net/jqwik/web/api/WebDomain.java: -------------------------------------------------------------------------------- 1 | package net.jqwik.web.api; 2 | 3 | import java.lang.annotation.*; 4 | 5 | import org.apiguardian.api.*; 6 | 7 | import static org.apiguardian.api.API.Status.*; 8 | 9 | /** 10 | * Constrain generated strings to be valid web domain names (e.g. {@code myhost.com}). 11 | * 12 | *

13 | * Applies to parameters of type {@linkplain String} that are also annotated with {@code @ForAll}. 14 | *

15 | * 16 | * @see net.jqwik.api.ForAll 17 | */ 18 | @Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE_USE}) 19 | @Retention(RetentionPolicy.RUNTIME) 20 | @Documented 21 | @API(status = EXPERIMENTAL, since = "1.5.5") 22 | public @interface WebDomain { 23 | } 24 | -------------------------------------------------------------------------------- /web/src/main/java/net/jqwik/web/api/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package net.jqwik.web.api; 3 | 4 | import org.jspecify.annotations.*; -------------------------------------------------------------------------------- /web/src/main/module/module-info.java: -------------------------------------------------------------------------------- 1 | module net.jqwik.web { 2 | 3 | exports net.jqwik.web.api; 4 | 5 | requires transitive net.jqwik.api; 6 | requires org.opentest4j; 7 | 8 | provides net.jqwik.api.providers.ArbitraryProvider with 9 | net.jqwik.web.EmailArbitraryProvider, 10 | net.jqwik.web.WebDomainArbitraryProvider; 11 | } 12 | -------------------------------------------------------------------------------- /web/src/main/resources/META-INF/services/net.jqwik.api.providers.ArbitraryProvider: -------------------------------------------------------------------------------- 1 | net.jqwik.web.EmailArbitraryProvider 2 | net.jqwik.web.WebDomainArbitraryProvider --------------------------------------------------------------------------------