From 6546881559e4bbcfe2b220199a9f3cd4196d1960 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Tue, 9 Jun 2015 23:58:41 +1000 Subject: A few changes, as suggested by static analysis --- .../java/au/id/zancanaro/javacheck/junit/Properties.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck/junit') diff --git a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java index a7bf19b..c428edc 100644 --- a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java +++ b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java @@ -26,11 +26,6 @@ public class Properties extends BlockJUnit4ClassRunner { provider = GeneratorProvider.DEFAULT_PROVIDER.withDataSources(classObject); } - @Override - protected void collectInitializationErrors(List errors) { - super.collectInitializationErrors(errors); - } - @Override protected void validateConstructor(List errors) { validateOnlyOneConstructor(errors); @@ -109,7 +104,7 @@ public class Properties extends BlockJUnit4ClassRunner { } catch (AssumptionViolatedException ex) { numTests++; if (assumptionsViolated++ == 50) { - throw new Error("Violated 50 assumptions in a row: failing test"); + throw new Error("Violated 50 assumptions in a row: failing test", ex); } } catch (Throwable ex) { throw new PropertyError(method.getName(), seed, shrink(tree, ex)); @@ -130,9 +125,11 @@ public class Properties extends BlockJUnit4ClassRunner { Iterator>> trees = failed.getChildren().iterator(); while (trees.hasNext()) { ShrinkTree> tree = trees.next(); - if (seenArgs.add(Arrays.asList(tree.getValue()))) { + List value = tree.getValue(); + boolean haveSeen = seenArgs.add(Arrays.asList(value)); + if (haveSeen) { try { - runTest(tree.getValue().toArray()); + runTest(value.toArray()); } catch (AssumptionViolatedException ex) { // ignore, because it's not useful } catch (Throwable ex) { -- cgit v1.2.3