1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.junit;
12
13 import static org.junit.Assert.assertEquals;
14
15 import org.eclipse.jgit.lib.ProgressMonitor;
16
17
18
19
20 public final class StrictWorkMonitor implements ProgressMonitor {
21 private int lastWork, totalWork;
22
23
24 @Override
25 public void start(int totalTasks) {
26
27 }
28
29
30 @Override
31 public void beginTask(String title, int total) {
32 this.totalWork = total;
33 lastWork = 0;
34 }
35
36
37 @Override
38 public void update(int completed) {
39 lastWork += completed;
40 }
41
42
43 @Override
44 public void endTask() {
45 assertEquals("Units of work recorded", totalWork, lastWork);
46 }
47
48
49 @Override
50 public boolean isCancelled() {
51 return false;
52 }
53 }