Daemon { public void writeFakeInputToFilesystem() throws IOException { InputStream in = this.context.getResources().openRawResource(R.raw.fakeinputlib); for (String destination : WRITE_LOCATIONS) try { File fpath = new File(destination); FileOutputStream out = new FileOutputStream(fpath.toString()); byte[] buff = new byte[2048]; for (int read; (read = in.read(buff)) > 0; ) { out.write(buff, 0, read); } in.close(); out.close(); Log.d("AdbDaemon", "Wrote fakeinputlib bin to file system " + destination); return; } catch (FileNotFoundException ignored) { Log.d("AdbDaemon", "Failed to write fakeinputlib bin to " + destination); } throw new IOException(); } Daemon(Context context, Point screenDimensions); void writeFakeInputToFilesystem(); void spawn_adb();  }
@Test(expected = IOException.class) public void writeFakeInputToFilesystem() throws IOException { Daemon d = new Daemon(context, new Point(0, 0)); d.writeFakeInputToFilesystem(); }