61 {
62
63
64
65 Context context = spy(ApplicationProvider.getApplicationContext());
66 InputMethodManager expected = mock(InputMethodManager.class);
67 when(context.getSystemService(Context.INPUT_METHOD_SERVICE)).thenReturn(expected);
68 Display display =
69 ((DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE)).getDisplay(0);
70 SingleViewPresentation svp =
71 new SingleViewPresentation(context, display, null, null, null, false);
72
73
74 InputMethodManager actual =
75 (InputMethodManager)
76 svp.getContext()
77 .createDisplayContext(display)
78 .getSystemService(Context.INPUT_METHOD_SERVICE);
79
80
81
82 assertEquals(expected, actual);
83 }