@@ -183,7 +183,7 @@ private static Object normalizeValue(Object value)
183183 }
184184 }
185185
186- private static String propertyError (Common <?> input , Throwable cause , Object ... values )
186+ private static StringBuilder propertyErrorCommon (Common <?> input , Throwable cause )
187187 {
188188 StringBuilder sb = new StringBuilder ();
189189 // return "Seed=" + seed + "\nExamples=" + examples;
@@ -201,6 +201,12 @@ private static String propertyError(Common<?> input, Throwable cause, Object...
201201 msg = cause .getClass ().getCanonicalName ();
202202 sb .append (msg ).append ('\n' );
203203 }
204+ return sb ;
205+ }
206+
207+ private static String propertyError (Common <?> input , Throwable cause , Object ... values )
208+ {
209+ StringBuilder sb = propertyErrorCommon (input , cause );
204210 if (values != null )
205211 {
206212 sb .append ("Values:\n " );
@@ -210,6 +216,18 @@ private static String propertyError(Common<?> input, Throwable cause, Object...
210216 return sb .toString ();
211217 }
212218
219+ private static String statefulPropertyError (StatefulBuilder input , Throwable cause , Object state , List <String > history )
220+ {
221+ StringBuilder sb = propertyErrorCommon (input , cause );
222+ sb .append ("Steps: " ).append (input .steps ).append ('\n' );
223+ sb .append ("Values:\n " );
224+ sb .append ("\t State: " ).append (state ).append (": " ).append (state == null ? "unknown type" : state .getClass ().getCanonicalName ()).append ('\n' );
225+ sb .append ("\t History:" ).append ('\n' );
226+ for (var event : history )
227+ sb .append ("\t \t " ).append (event ).append ('\n' );
228+ return sb .toString ();
229+ }
230+
213231 public interface FailingConsumer <A >
214232 {
215233 void accept (A value ) throws Exception ;
@@ -449,7 +467,7 @@ public <State, SystemUnderTest> void check(Commands<State, SystemUnderTest> comm
449467 }
450468 catch (Throwable t )
451469 {
452- throw new PropertyError (propertyError (this , t , state , history ), t );
470+ throw new PropertyError (statefulPropertyError (this , t , state , history ), t );
453471 }
454472 if (pure )
455473 {
0 commit comments