Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09f4d728 authored by Adrian Roos's avatar Adrian Roos
Browse files

RavenwoodUtils: remove verifyZeroInteractions wrapper

This is no longer necessary, with the upgrade to Mockito 3 `verifyNoInteractions` is now in the tree.

There are two downsides to having this available:
- The current implementation of MockitoHelper.verifyZeroInteractions  will fail at runtime when on-device tests migrate to Mockito 4+
- Mockito.verifyZeroInteractions has the same behavior as
verify no*More*Interactions. Tests using MockitoHelper.verifyZeroInteractions will therefore observe different behavior on ravenwood and on-device.

Bug: 310268946
Test: n/a, deleted code without usage
Flag: TEST_ONLY
Change-Id: I8e1406a99d748828724b6ac82d2a018a53e725ea
parent 448853d0
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -128,28 +128,6 @@ public class RavenwoodUtils {
        runOnHandlerSync(getMainHandler(), r);
    }

    public static class MockitoHelper {
        private MockitoHelper() {
        }

        /**
         * Allow verifyZeroInteractions to work on ravenwood. It was replaced with a different
         * method on. (Maybe we should do it in Ravenizer.)
         */
        public static void verifyZeroInteractions(Object... mocks) {
            if (RavenwoodRule.isOnRavenwood()) {
                // Mockito 4 or later
                reflectMethod("org.mockito.Mockito", "verifyNoInteractions", Object[].class)
                        .callStatic(new Object[]{mocks});
            } else {
                // Mockito 2
                reflectMethod("org.mockito.Mockito", "verifyZeroInteractions", Object[].class)
                        .callStatic(new Object[]{mocks});
            }
        }
    }


    /**
     * Wrap the given {@link Supplier} to become memoized.
     *