// Path: deferred/src/main/java/com/tuenti/deferred/Promise.java
// enum State {
// 	/**
// 	 * The Promise is still pending - it could be created, submitted for execution,
// 	 * or currently running, but not yet finished.
// 	 */
// 	PENDING,
// 
// 	/**
// 	 * The Promise has finished running and a failure occurred.
// 	 * Thus, the Promise is rejected.
// 	 *
// 	 * @see Deferred#reject(Object)
// 	 */
// 	REJECTED,
// 
// 	/**
// 	 * The Promise has finished running successfully.
// 	 * Thus the Promise is resolved.
// 	 *
// 	 * @see Deferred#resolve(Object)
// 	 */
// 	RESOLVED
// }


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
import org.junit.Test;
import com.tuenti.deferred.Promise.State;
			}
		}).fail(new FailCallback() {
			public void onFail(Object result) {
				failCount.incrementAndGet();
			}
		});

		waitForCompletion();
		holder.assertEquals(100);
		Assert.assertEquals(0, failCount.get());
	}

	@Test
	public void testAlwaysDone() {
		final AtomicInteger failCount = new AtomicInteger();
		final AtomicInteger alwaysCount = new AtomicInteger();
		final ValueHolder<Integer> holder = new ValueHolder<Integer>();

		deferredManager.when(successCallable(100, 1000))
				.done(new DoneCallback() {
					public void onDone(Object result) {
						Assert.assertEquals(result, 100);
						holder.set((Integer) result);
					}
				}).fail(new FailCallback() {
					public void onFail(Object result) {
						failCount.incrementAndGet();
					}
				}).always(new AlwaysCallback<Integer, Throwable>() {
					@Override
// Path: deferred/src/main/java/com/tuenti/deferred/Promise.java
// enum State {
// 	/**
// 	 * The Promise is still pending - it could be created, submitted for execution,
// 	 * or currently running, but not yet finished.
// 	 */
// 	PENDING,
// 
// 	/**
// 	 * The Promise has finished running and a failure occurred.
// 	 * Thus, the Promise is rejected.
// 	 *
// 	 * @see Deferred#reject(Object)
// 	 */
// 	REJECTED,
// 
// 	/**
// 	 * The Promise has finished running successfully.
// 	 * Thus the Promise is resolved.
// 	 *
// 	 * @see Deferred#resolve(Object)
// 	 */
// 	RESOLVED
// }


// Path: deferred/src/test/java/com/tuenti/deferred/SinglePromiseTest.java
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.Assert;
import org.junit.Test;
import com.tuenti.deferred.Promise.State;

			}
		}).fail(new FailCallback() {
			public void onFail(Object result) {
				failCount.incrementAndGet();
			}
		});

		waitForCompletion();
		holder.assertEquals(100);
		Assert.assertEquals(0, failCount.get());
	}

	@Test
	public void testAlwaysDone() {
		final AtomicInteger failCount = new AtomicInteger();
		final AtomicInteger alwaysCount = new AtomicInteger();
		final ValueHolder<Integer> holder = new ValueHolder<Integer>();

		deferredManager.when(successCallable(100, 1000))
				.done(new DoneCallback() {
					public void onDone(Object result) {
						Assert.assertEquals(result, 100);
						holder.set((Integer) result);
					}
				}).fail(new FailCallback() {
					public void onFail(Object result) {
						failCount.incrementAndGet();
					}
				}).always(new AlwaysCallback<Integer, Throwable>() {
					@Override
					public void onAlways(State state, Integer resolved,