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

Commit 14c2aaa0 authored by Jack Yu's avatar Jack Yu
Browse files

Added test cases for DataCallResponse parcel read/write

bug: 64132030
Test: Unit tests
Change-Id: I87a9af987dd7366bfe6b22252e2c4bdc0fbdd727
parent e44609b1
Loading
Loading
Loading
Loading
+42 −2
Original line number Diff line number Diff line
@@ -116,7 +116,6 @@ public final class DataCallResponse implements Parcelable {
     */
    public int getSuggestedRetryTime() { return mSuggestedRetryTime; }


    /**
     * @return The unique id of the data connection.
     */
@@ -183,15 +182,56 @@ public final class DataCallResponse implements Parcelable {
           .append(" active=").append(mActive)
           .append(" type=").append(mType)
           .append(" ifname=").append(mIfname)
           .append(" mtu=").append(mMtu)
           .append(" addresses=").append(mAddresses)
           .append(" dnses=").append(mDnses)
           .append(" gateways=").append(mGateways)
           .append(" pcscf=").append(mPcscfs)
           .append(" mtu=").append(mMtu)
           .append("}");
        return sb.toString();
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;

        if (o == null || !(o instanceof DataCallResponse)) {
            return false;
        }

        DataCallResponse other = (DataCallResponse) o;
        return this.mStatus == other.mStatus
                && this.mSuggestedRetryTime == other.mSuggestedRetryTime
                && this.mCid == other.mCid
                && this.mActive == other.mActive
                && this.mType.equals(other.mType)
                && this.mIfname.equals(other.mIfname)
                && mAddresses.size() == other.mAddresses.size()
                && mAddresses.containsAll(other.mAddresses)
                && mDnses.size() == other.mDnses.size()
                && mDnses.containsAll(other.mDnses)
                && mGateways.size() == other.mGateways.size()
                && mGateways.containsAll(other.mGateways)
                && mPcscfs.size() == other.mPcscfs.size()
                && mPcscfs.containsAll(other.mPcscfs)
                && mMtu == other.mMtu;
    }

    @Override
    public int hashCode() {
        return mStatus * 31
                + mSuggestedRetryTime * 37
                + mCid * 41
                + mActive * 43
                + mType.hashCode() * 47
                + mIfname.hashCode() * 53
                + mAddresses.hashCode() * 59
                + mDnses.hashCode() * 61
                + mGateways.hashCode() * 67
                + mPcscfs.hashCode() * 71
                + mMtu * 73;
    }

    @Override
    public int describeContents() {
        return 0;
+17 −0
Original line number Diff line number Diff line
@@ -78,6 +78,23 @@ public final class InterfaceAddress implements Parcelable {
     */
    public int getNetworkPrefixLength() { return mPrefixLength; }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;

        if (o == null || !(o instanceof InterfaceAddress)) {
            return false;
        }

        InterfaceAddress other = (InterfaceAddress) o;
        return this.mInetAddress.equals(other.mInetAddress)
                && this.mPrefixLength == other.mPrefixLength;
    }

    @Override
    public int hashCode() {
        return mInetAddress.hashCode() * 31 + mPrefixLength * 37;
    }

    @Override
    public int describeContents() {