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

Commit c6fe2533 authored by Achim Thesmann's avatar Achim Thesmann
Browse files

Use EqualsTester

Test: atest BackgroundStartPrivilegesTest
Flag: EXEMPT test only
Bug: 322159724
Change-Id: Idceea7029019dfa640e1c0673e587fbc6c4e715f
parent 8aef21b7
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();
    }
}