@Test
public void cancelAll() throws Exception {

    int count = 5;
    Window<Integer,String,String> window = new Window<Integer,String,String>(count);
    String[] requests = new String[count];
    for (int i = 0; i < count; i++) {
        requests[i] = "Request" + i;
    }
    for (int i = 0; i < 3; i++) {
        window.offer(i, requests[i], 100);
    }
    Assert.assertEquals(3, window.getSize());
    // are there requests pending?
    List<WindowFuture<Integer,String,String>> cancelled = window.cancelAll();
    Assert.assertEquals(0, window.getSize());
    Assert.assertEquals(3, cancelled.size());
    for (int i = 0; i < 3; i++) {
        WindowFuture<Integer,String,String> value = cancelled.get(i);
        Assert.assertEquals("Request"+value.getKey(), value.getRequest());
        Assert.assertEquals(true, value.getAcceptTimestamp() > 0);
        Assert.assertEquals(null, value.getResponse());
        Assert.assertEquals(true, value.getDoneTimestamp() > 0);
        Assert.assertEquals(true, value.isCancelled());
        Assert.assertEquals(true, value.isDone());
        Assert.assertEquals(false, value.isSuccess());
    }
}