### Question:
RootContext { public ContextSwitch getContextSwitch() { return contextSwitch; } RootContext(Root root, SuBinary suBinary, SuApp suApp, SELinux seLinux, ContextSwitch contextSwitch); boolean isRooted(); Root getRoot(); SuBinary getSuBinary(); SuApp getSuApp(); SELinux getSELinux(); ContextSwitch getContextSwitch(); @Override String toString(); static final RootContext EMPTY; }### Answer:
@Test public void testContextSwitching_superSu() { when(suBinaryBuilder.build()).thenReturn(Single.just(new SuBinary(SuBinary.Type.CHAINFIRE_SUPERSU, null, null, null, new ArrayList<>()))); RootContext.Builder builder = new RootContext.Builder(context); builder.rootBuilder(rootBuilder); builder.seLinuxBuilder(seLinuxBuilder); builder.suAppBuilder(suAppBuilder); builder.suBinaryBuilder(suBinaryBuilder); builder.shellBuilder(shellBuilder); final RootContext rootContext = builder.build().blockingGet(); final String switchCommand = rootContext.getContextSwitch().switchContext("acontext", "somecommand"); assertThat(switchCommand, containsString("'somecommand'")); assertThat(switchCommand, containsString("--context acontext")); assertThat(switchCommand, is("su --context acontext -c 'somecommand' < /dev/null")); }