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

Commit c7f7535e authored by Hyundo Moon's avatar Hyundo Moon Committed by Cherrypicker Worker
Browse files

Add test for AdapterService.dump()

This calls all other dump() methods in package
com.android.bluetooth.btservice, so no other dump tests are needed.

Bug: 237467631
Test: atest AdapterServiceTest#testDump
Change-Id: I0da8f9aa8004f2f511666ec39cbb2a7d220840bf
(cherry picked from commit 81101987)
Merged-In: I0da8f9aa8004f2f511666ec39cbb2a7d220840bf
parent ac4d6b31
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
@@ -994,4 +996,15 @@ public class AdapterServiceTest {
        int id2 = mAdapterService.getMetricId(device);
        Assert.assertEquals(id2, id1);
    }

    @Test
    public void testDump_doesNotCrash() {
        FileDescriptor fd = new FileDescriptor();
        PrintWriter writer = mock(PrintWriter.class);

        mAdapterService.dump(fd, writer, new String[]{});
        mAdapterService.dump(fd, writer, new String[]{"set-test-mode", "enabled"});
        mAdapterService.dump(fd, writer, new String[]{"--proto-bin"});
        mAdapterService.dump(fd, writer, new String[]{"random", "arguments"});
    }
}