@Test public void testFileRequestCancel() throws InterruptedException { MockFileRequest request1 = new MockFileRequest("123", null, null); request1.setTag("test_tag"); MockFileRequest request2 = new MockFileRequest("456", null, null); request2.setTag("test_tag_2"); MockFileRequest request3 = new MockFileRequest("789", null, null); request3.setTag("test_tag"); fileQueue.add(request1); fileQueue.add(request2); fileQueue.add(request3); fileQueue.cancelAll("test_tag"); assertTrue(request1.isCanceled()); assertFalse(request2.isCanceled()); assertTrue(request3.isCanceled()); }
@Test public void testFileBlocking() { MockFileRequest request1 = new MockFileRequest("123", null, null); request1.setTag("test_tag"); MockFileRequest request2 = new MockFileRequest("123", null, null); request2.setTag("test_tag_2"); MockFileRequest request3 = new MockFileRequest("123", null, null); request3.setTag("test_tag"); fileQueue.add(request1); fileQueue.add(request2); fileQueue.add(request3); Collection<FileRequest<?>> requestQueue = fileQueue.getRequestQueue(); assertTrue(requestQueue.contains(request1)); assertFalse(requestQueue.contains(request2)); assertFalse(requestQueue.contains(request3)); }