@Test
public void interruptsOnCompensableTimeoutExceptionWithIOBlocked() throws Throwable {

  when(compensable.forwardTimeout()).thenReturn(2);
  when(joinPoint.proceed()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
      String name = "delete.me";
      new File(name).deleteOnExit();
      RandomAccessFile raf = new RandomAccessFile(name, "rw");
      FileChannel fc = raf.getChannel();
      try {
        ByteBuffer buffer = ByteBuffer.wrap(new String("1").getBytes());
        while (true) {
          fc.write(buffer);
        }
      } finally {
        if (fc != null) {
          fc.close();
        }
      }
    }
  });
  try {
    aspect.advise(joinPoint, compensable);
  } catch (RuntimeException e) {
    assertThat(e, instanceOf(TransactionTimeoutException.class));
    assertThat(e.getCause(), instanceOf(ClosedByInterruptException.class));
  }
}