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); }
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); }
@Nullable Object getReplacementInstanceForMethodInvocation( @Nonnull Object invokedInstance, @Nonnull String methodNameAndDesc) { return methodNameAndDesc.charAt(0) == '<' ? null : replacementMap.get(invokedInstance); }