@Override
  public int computeSimilarityScore(IMockInvocation invocation) {
    int score = 0;
    int weight = constraints.size();
    for (IInvocationConstraint constraint : constraints) {
      boolean satisfied;
      try {
        satisfied = constraint.isSatisfiedBy(invocation);
      } catch (Exception e) {
        // can happen because we evaluate (code) argument constraints
        // even if target and/or method constraints aren't satisfied
        satisfied = false;
      }
      if (!satisfied) {
        score += weight;
      }
      weight--;
    }
    return score;
  }
An anticipated interaction between the SUT and one or more mock objects.

<p>An instance of this class is confined to a {@link MockController} and all method calls
should be done in {@code synchronized} blocks that synchronize on that Mock controller to
ensure proper interaction matching and invocation counting. Due to that this class is not
thread-safe.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/mock/runtime/MockInteraction.java