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

Commit f0cfa61c authored by Tony Mak's avatar Tony Mak
Browse files

Fix a broken test by mocking PackageManager

There is no email app in AOSP, and thus the test fails.
Mocking the package manager output to fix the test

Test: atest frameworks/base/core/tests/coretests/src/android/view/textclassifier/TextClassifierTest.java

Fixes: 139536812
Fixes: 145209230

Change-Id: Ie2dd599528074266d45044b1785a1b7d71caa1d3
parent 56af6730
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -548,8 +548,10 @@ public class TextClassifierTest {
    }

    @Test
    public void testSuggetsConversationActions_deduplicate() {
        if (isTextClassifierDisabled()) return;
    public void testSuggestConversationActions_deduplicate() {
        Context context = new FakeContextBuilder()
                .setIntentComponent(Intent.ACTION_SENDTO, FakeContextBuilder.DEFAULT_COMPONENT)
                .build();
        ConversationActions.Message message =
                new ConversationActions.Message.Builder(
                        ConversationActions.Message.PERSON_USER_OTHERS)
@@ -560,7 +562,8 @@ public class TextClassifierTest {
                        .setMaxSuggestions(3)
                        .build();

        ConversationActions conversationActions = mClassifier.suggestConversationActions(request);
        TextClassifier classifier = new TextClassifierImpl(context, TC_CONSTANTS);
        ConversationActions conversationActions = classifier.suggestConversationActions(request);

        Truth.assertThat(conversationActions.getConversationActions()).isEmpty();
    }