### Question:
UserKiller implements ProcessKiller { @SuppressLint("NewApi") @Override public boolean kill(Process process) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("kill(%s)", process); if (!ProcessHelper.isAlive(process)) { if (RXSDebug.isDebug()) Timber.tag(TAG).d("Process is no longer alive, skipping kill."); return true; } if (ApiWrap.hasOreo()) process.destroyForcibly(); else process.destroy(); return true; }  @SuppressLint("NewApi") @Override boolean kill(Process process);  }### Answer:
@Test public void testKill_legacy() { ApiWrap.setSDKInt(16); when(process.exitValue()).thenThrow(new IllegalThreadStateException()); final ProcessKiller killer = new UserKiller(); killer.kill(process); verify(process).destroy(); }
@Test public void testKill_oreo() { ApiWrap.setSDKInt(26); when(process.isAlive()).thenReturn(true); final ProcessKiller killer = new UserKiller(); killer.kill(process); verify(process).destroyForcibly(); }