@Override
  public String getMessage() {
    if (message != null) return message;
    StringBuilder builder = new StringBuilder();
    builder.append("Wrong invocation order for:\n\n");
    builder.append(interaction);
    builder.append("\n\n");
    builder.append("Last invocation: ");
    builder.append(lastInvocation);
    builder.append("\n\n");
    if (previousInvocationsInReverseOrder.size() == 1) {
      builder.append("Previous invocation:\n\t");
      builder.append(previousInvocationsInReverseOrder.get(0));
    } else {
      builder.append("Previous invocations in reverse order:");
      previousInvocationsInReverseOrder.forEach(invocation -> {
        builder.append("\n\t");
        builder.append(invocation);
      });
    }
    builder.append("\n");

    message = builder.toString();
    return message;
  }
Thrown if an invocation on a mock object occurs too late. Example:

<pre>
when:
...

then:
1 * foo.me()
1 * bar.me()

then: // indicates that subsequent interactions must take place after previous interactions
1 * baz.me()
</pre>

Assuming the following invocation order:

<ol>
<li>bar.me()</li>
<li>baz.me()</li>
<li>foo.me()</li>
</ol>

A <tt>WrongInvocationOrderError</tt> will be thrown on the third call.
spock-core/src/main/java/org/spockframework/mock/WrongInvocationOrderError.java