From 7c81cab9ab9f8e0e58ee11fb1d2bb559ba5e8f73 Mon Sep 17 00:00:00 2001 From: Johannes Link Date: Tue, 22 Aug 2023 11:43:05 +0200 Subject: [PATCH] Got rid of a few TODOs --- TODO.md | 9 +++------ .../properties/arbitraries/UseGeneratorsArbitrary.java | 1 - .../properties/configurators/SizeConfigurator.java | 4 +--- .../src/main/java/net/jqwik/testing/TestingSupport.java | 9 +-------- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/TODO.md b/TODO.md index 0d8d32060..63eb66733 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,8 @@ # 1.8.0 - - Check TODOs in code - - Deprecate some APIs? + - Include compileOnly("org.jetbrains:annotations:23.0.0") into API? + Or rather jspecify annotations? To get rid of build warnings. + # 1.8.x @@ -45,7 +46,3 @@ - Allow @ForAll on member variables of test container class - -# 1.8.0 - - - Include compileOnly("org.jetbrains:annotations:23.0.0") into API? diff --git a/engine/src/main/java/net/jqwik/engine/properties/arbitraries/UseGeneratorsArbitrary.java b/engine/src/main/java/net/jqwik/engine/properties/arbitraries/UseGeneratorsArbitrary.java index cf9ade87c..c5a2eb3fa 100644 --- a/engine/src/main/java/net/jqwik/engine/properties/arbitraries/UseGeneratorsArbitrary.java +++ b/engine/src/main/java/net/jqwik/engine/properties/arbitraries/UseGeneratorsArbitrary.java @@ -5,7 +5,6 @@ import net.jqwik.api.*; -// TODO: This class is probably not needed at all. Its methods could be pushed down to subclasses. abstract class UseGeneratorsArbitrary implements Arbitrary { private final RandomGenerator randomGenerator; diff --git a/engine/src/main/java/net/jqwik/engine/properties/configurators/SizeConfigurator.java b/engine/src/main/java/net/jqwik/engine/properties/configurators/SizeConfigurator.java index 2af10314c..a447049ee 100644 --- a/engine/src/main/java/net/jqwik/engine/properties/configurators/SizeConfigurator.java +++ b/engine/src/main/java/net/jqwik/engine/properties/configurators/SizeConfigurator.java @@ -38,9 +38,7 @@ public ActionSequenceArbitrary configure(ActionSequenceArbitrary arbitrary "%n This usage will throw exception starting with version 1.7.0.", size, effectiveSize ); - LOG.warning(message); - // TODO: Throw exception as soon as release 1.7.0 - // throw new JqwikException(message); + throw new JqwikException(message); } return arbitrary.ofSize(effectiveSize); } diff --git a/testing/src/main/java/net/jqwik/testing/TestingSupport.java b/testing/src/main/java/net/jqwik/testing/TestingSupport.java index 838c45bac..8cee2e708 100644 --- a/testing/src/main/java/net/jqwik/testing/TestingSupport.java +++ b/testing/src/main/java/net/jqwik/testing/TestingSupport.java @@ -148,15 +148,8 @@ public static Map count(RandomGenerator generator, int tries, Ra .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); } - // TODO: Call from TestingSupportFacade public static Shrinkable generateUntil(RandomGenerator generator, Random random, Function condition) { - long maxTries = 1000; - return generator - .stream(random) - .limit(maxTries) - .filter(shrinkable -> condition.apply(shrinkable.value())) - .findFirst() - .orElseThrow(() -> new JqwikException("Failed to generate value that fits condition after " + maxTries + " tries.")); + return TestingSupportFacade.implementation.generateUntil(generator, random, condition); } @API(status = EXPERIMENTAL, since = "1.6.0")