@Test
  public void hasProgressWithoutSize() {
    t.setSize(0);
    t.setTransferred(0);

    assertEquals(0.0, t.getProgress(), PRECISION);
  }
  @Test
  public void notifiesOnStateChange() {
    Transaction t = new DummyTransaction();
    t.onProgress(() -> progress.add(null));
    t.toState(FAILED);

    assertEquals(1, progress.size());
  }
  @Test
  public void notifiesOnProgress() {
    Transaction t = new DummyTransaction();
    t.onProgress(() -> progress.add(null));
    t.setTransferred(10L);

    assertEquals(1, progress.size());
  }
 @Test
 public void notifiesOnSkippedClose() {
   try (Transaction t = new DummyTransaction()) {
     t.toState(SKIPPED);
     t.onSkipped(() -> updates.add(SKIPPED));
   }
   assertEquals("missing skipped notification", 1, updates.size());
 }
 @Test
 public void notifiesOnFailedClose() {
   try (Transaction t = new DummyTransaction()) {
     t.toState(FAILED);
     t.onFailure(() -> updates.add(FAILED));
   }
   assertEquals("missing failure notification", 1, updates.size());
 }
 @Test
 public void notifiesOnSuccessfulClose() {
   try (Transaction t = new DummyTransaction()) {
     t.toState(FINISHED);
     t.onSuccess(() -> updates.add(FINISHED));
   }
   assertEquals("missing success notification", 1, updates.size());
 }
 @Test
 public void knowsWhenItHasNoSize() {
   Transaction t = new DummyTransaction();
   t.setSize(0);
   assertFalse(t.hasSize());
 }