diff options
Diffstat (limited to 'src/main/java/au/id/zancanaro/PropertyError.java')
-rw-r--r-- | src/main/java/au/id/zancanaro/PropertyError.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/au/id/zancanaro/PropertyError.java b/src/main/java/au/id/zancanaro/PropertyError.java deleted file mode 100644 index a0ee6df..0000000 --- a/src/main/java/au/id/zancanaro/PropertyError.java +++ /dev/null @@ -1,49 +0,0 @@ -package au.id.zancanaro; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; - -public class PropertyError extends AssertionError { - public PropertyError(String methodName, long seed, ShrinkResult shrunk) { - super(shrunk.thrown.getMessage() == null ? - String.format("%s(%s)\n\tSeed: %s", - methodName, join(", ", shrunk.args), - seed): - String.format("%s(%s)\n\tSeed: %s\n%s", - methodName, join(", ", shrunk.args), - seed, - shrunk.thrown.getMessage())); - initCause(shrunk.thrown); - } - - - public static String join(String delimiter, Object... params) { - return join(delimiter, Arrays.asList(params)); - } - - public static String join(String delimiter, Collection<Object> values) { - StringBuilder sb = new StringBuilder(); - Iterator<Object> iter = values.iterator(); - while (iter.hasNext()) { - Object next = iter.next(); - sb.append(stringValueOf(next)); - if (iter.hasNext()) { - sb.append(delimiter); - } - } - return sb.toString(); - } - - private static String stringValueOf(Object next) { - if (next instanceof String) { - return '"' + ((String) next).replace("\"", "\\\"") + '"'; - } else { - try { - return String.valueOf(next); - } catch (Throwable e) { - return "[toString failed]"; - } - } - } -} |