private void registerReplacementInstanceIfApplicable(
      @Nullable Object mock, @Nonnull ExpectedInvocation invocation) {
    Object replacementInstance = invocation.replacementInstance;

    if (replacementInstance != null && replacementInstance != invocation.instance) {
      replacementMap.put(mock, replacementInstance);
    }
  }
 void registerRead() {
   int testId = TestRun.getTestId();
   testIdsToAssignments.put(testId, null);
   readCount++;
 }
 void registerAssignment() {
   int testId = TestRun.getTestId();
   testIdsToAssignments.put(testId, Boolean.TRUE);
   writeCount++;
 }