Mock mockProgressIndicator = mock(ProgressIndicator.class);
mockProgressIndicator.expects(atLeastOnce()).method("setText").with(eq("Found in local network: 1 user"));
mockProgressIndicator.expects(atLeastOnce()).method("checkCanceled");
final double[] lastFraction = new double[]{-1};
mockProgressIndicator.expects(atLeastOnce()).method("setFraction").with(new IsGreaterThan(new Comparable() {
@Override
public int compareTo(Object o) {
double v = ((Number) o).doubleValue();
int result = (int) ((lastFraction[0] - v) * 100);
lastFraction[0] = v;