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

Commit 0f3c3c0e authored by Achim Thesmann's avatar Achim Thesmann Committed by Android (Google) Code Review
Browse files

Merge "Use EqualsTester" into main

parents bb04a086 c6fe2533
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ android_test {
        "frameworks-core-util-lib",
        "mockwebserver",
        "guava",
        "guava-android-testlib",
        "android.app.usage.flags-aconfig-java",
        "android.view.accessibility.flags-aconfig-java",
        "androidx.core_core",
+13 −7
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ import android.os.IBinder;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;

import com.google.common.testing.EqualsTester;

import org.junit.Test;
import org.junit.runner.RunWith;

@@ -122,12 +124,16 @@ public class BackgroundStartPrivilegesTest {

    @Test
    public void backgroundStartPrivilege_equals_works() {
        assertThat(NONE).isEqualTo(NONE);
        assertThat(ALLOW_BAL).isEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isEqualTo(ALLOW_FGS);
        assertThat(BSP_ALLOW_A).isEqualTo(BSP_ALLOW_A);
        assertThat(NONE).isNotEqualTo(ALLOW_BAL);
        assertThat(ALLOW_FGS).isNotEqualTo(ALLOW_BAL);
        assertThat(BSP_ALLOW_A).isNotEqualTo(BSP_ALLOW_B);
        Binder token = new Binder();
        Binder anotherToken = new Binder();
        new EqualsTester()
                .addEqualityGroup(NONE)
                .addEqualityGroup(ALLOW_BAL)
                .addEqualityGroup(ALLOW_FGS)
                .addEqualityGroup(BackgroundStartPrivileges.allowBackgroundActivityStarts(token),
                        BackgroundStartPrivileges.allowBackgroundActivityStarts(token))
                .addEqualityGroup(
                        BackgroundStartPrivileges.allowBackgroundActivityStarts(anotherToken))
                .testEquals();
    }
}