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

Commit 81101987 authored by Hyundo Moon's avatar Hyundo Moon
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
parent 9cf3ccc5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -98,6 +98,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;
@@ -1004,4 +1006,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"});
    }
}