ProcessStatus { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProcessStatus that = (ProcessStatus) o; float delta = that.progress - progress; if (delta < 0) { delta = -delta; } return delta <= EPS && message.equals(that.message) && state == that.state; } ProcessStatus(ProcessState state);  ProcessStatus(ProcessState state, float progress);  ProcessStatus(ProcessState state, float progress, String message); static ProcessStatus aggregate(ProcessStatus... statuses); ProcessState getState(); boolean isDone(); String getMessage(); float getProgress(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static ProcessStatus aggregateUnsustainable(ProcessStatus... statuses); final static ProcessStatus UNKNOWN; final static ProcessStatus SCHEDULED; }
@Test public void testEquals() { ProcessStatus status = ProcessStatus.UNKNOWN; assertTrue(status.equals(status)); assertTrue(status.equals(new ProcessStatus(ProcessState.UNKNOWN))); assertTrue(new ProcessStatus(ProcessState.COMPLETED).equals( new ProcessStatus(ProcessState.COMPLETED))); assertTrue(new ProcessStatus(ProcessState.RUNNING, 0.2f, "Dabei!").equals( new ProcessStatus(ProcessState.RUNNING, 0.2f, "Dabei!"))); assertTrue(new ProcessStatus(ProcessState.RUNNING, 0.20001f, "Dabei!").equals( new ProcessStatus(ProcessState.RUNNING, 0.20003f, "Dabei!"))); }
@Test public void testNotEquals() { assertFalse(new ProcessStatus(ProcessState.ERROR, 0.1f, "").equals( new ProcessStatus(ProcessState.COMPLETED, 0.1f, ""))); assertFalse(new ProcessStatus(ProcessState.RUNNING, 0.21f, "").equals( new ProcessStatus(ProcessState.RUNNING, 0.22f, ""))); assertFalse(new ProcessStatus(ProcessState.RUNNING, 0.2f, "Dabei!").equals( new ProcessStatus(ProcessState.RUNNING, 0.2f, "Vorbei!"))); }