private boolean compareExtras(Intent other) {
      if (other == null) {
        return false;
      }

      Bundle myExtras = this.getExtras();
      Bundle theirExtras = other.getExtras();

      if (myExtras == null && theirExtras == null) {
        return true;
      }

      if (myExtras.size() != theirExtras.size()) {
        return false;
      }

      for (String key : myExtras.keySet()) {
        if (!theirExtras.containsKey(key) || !myExtras.get(key).equals(theirExtras.get(key))) {
          return false;
        }
      }

      return true;
    }
Intent that can be compared to another Intent (base Intent doesn't override equals method)

<p>Reason: (new Intent("MY_ACTION)).equals(new Intent("MY_ACTION")) returns false. This is
really annoying for unit tests for testing expecting method calls.

<p>A ComparableIntent can be used instead of an Intent when calling:
Mockito.verify(myMock).myFunction(new ComparableIntent("MY_ACTION")). This avoids the
shenanigan to use an ArgumentCaptor.

<p>Warning: this breaks the usual contract of equals that A.equals(B) means B.equals(A), so
this should be used just for testing.
javatests/com/google/android/apps/authenticator/testing/TestUtilities.java