@Test
@PrepareForTest({Log.class, Os.class})

public void testPoll_fault() throws Exception {
    mockStatic(Log.class);
    mockStatic(Os.class);
    // Eww, Android is playing dirty and setting all errno values to 0.
    // Hack around it so we can test that aborting the loop works.
    final ErrnoException e = new ErrnoException("foo", 42);
    e.getClass().getDeclaredField("errno").setInt(e, 42);
    when(Os.poll(any(StructPollfd[].class), anyInt())).then(new Answer<Integer>() {
        @Override
        public Integer answer(InvocationOnMock invocation) throws Throwable {
            testResult++;
            throw e;
        }
    });
    try {
        FileHelper.poll(null, 0);
        fail("Did not throw");
    } catch (ErrnoException e1) {
        assertEquals(42, e1.errno);
        assertSame(e, e1);
    }
    assertEquals(1, testResult);
}