コード例 #1
0
 boolean isEquivalentInstance(
     @Nonnull Object invocationInstance, @Nonnull Object invokedInstance) {
   return invocationInstance == invokedInstance
       || invocationInstance == replacementMap.get(invokedInstance)
       || invocationInstance == instanceMap.get(invokedInstance)
       || invokedInstance == instanceMap.get(invocationInstance)
       || TestRun.getExecutingTest()
           .isInvokedInstanceEquivalentToCapturedInstance(invocationInstance, invokedInstance);
 }
コード例 #2
0
  boolean areInDifferentEquivalenceSets(@Nonnull Object mock1, @Nonnull Object mock2) {
    if (mock1 == mock2 || instanceMap.isEmpty()) {
      return false;
    }

    Object mock1Equivalent = instanceMap.get(mock1);
    Object mock2Equivalent = instanceMap.get(mock2);

    if (mock1Equivalent == mock2 || mock2Equivalent == mock1) {
      return false;
    }

    if (mock1Equivalent != null && mock2Equivalent != null) {
      return true;
    }

    return instanceMapHasMocksInSeparateEntries(mock1, mock2);
  }
コード例 #3
0
 @Nullable
 Object getReplacementInstanceForMethodInvocation(
     @Nonnull Object invokedInstance, @Nonnull String methodNameAndDesc) {
   return methodNameAndDesc.charAt(0) == '<' ? null : replacementMap.get(invokedInstance);
 }