AsyncExecution implements Comparable<AsyncExecution> { public Status getStatus() { return status; } AsyncExecution();  AsyncExecution(String group);  AsyncExecution(String group, String id); static Comparator<AsyncExecution> reverseStartDateComparator(); static Comparator<AsyncExecution> reverseEndDateComparator(); Time getTime(); void setTime(Time time); String getGroup(); void setGroup(String group); String getId(); void setId(String id); ErrorCode getError(); void setError(ErrorCode error); ExecutionProgress getProgress(); void setProgress(ExecutionProgress progress); Status getStatus(); void setStatus(Status status); void updateExecutionState(Status status); void setException(Throwable error); String getUserId(); void setUserId(String userId); void setResult(AsyncExecutionResult result); AsyncExecutionResult getResult(); @Override String toString(); @Override boolean equals(Object o); @JsonIgnore boolean isResumable(); String getTenantId(); void setTenantId(String tenantId); @Override int hashCode(); void setDispatchId(String dispatchId); String getDispatchId(); @Override int compareTo(AsyncExecution o);  }
@Test public void shouldOrderRunningFirst() { List<AsyncExecution> unOrderedAsyncs = Lists.newArrayList(buildAsyncExecution(AsyncExecution.Status.NEW, 100L), buildAsyncExecution(AsyncExecution.Status.DONE, 100L), buildAsyncExecution(AsyncExecution.Status.RUNNING, 100L), buildAsyncExecution(AsyncExecution.Status.CANCELLED, 100L), buildAsyncExecution(AsyncExecution.Status.FAILED, 100L)); unOrderedAsyncs.sort(naturalOrder()); assertEquals(AsyncExecution.Status.RUNNING, unOrderedAsyncs.get(0).getStatus()); }