// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/gui/SimpleMockActivity.java
// public final class SimpleMockActivity extends MockActivity {
// 
//     private final static String OPERATION_TAG = "activity_operation_tag";
// 
//     private String mResult;
// 
//     private Exception mError;
// 
//     private String mBroadcastResult;
// 
//     private Exception mBroadcastError;
// 
//     private int mResultObtained = 0;
// 
//     private int mBroadcastResultObtained = 0;
// 
//     @Nullable
//     public String getResult() {
//         return mResult;
//     }
// 
//     @Nullable
//     public Exception getError() {
//         return mError;
//     }
// 
//     @Nullable
//     public String getBroadcastResult() {
//         return mBroadcastResult;
//     }
// 
//     @Nullable
//     public Exception getBroadcastError() {
//         return mBroadcastError;
//     }
// 
//     public int getBroadcastResultObtained() {
//         return mBroadcastResultObtained;
//     }
// 
//     public final int runSimple(@NonNull final String input) {
//         return runOperation(new SimpleOperation(input));
//     }
// 
//     public final int runBroadcast(@NonNull final String input) {
//         return runOperationBroadcast(new SimpleOperation(input));
//     }
// 
//     public final int runSimpleTagged(@NonNull final String input) {
//         return runOperation(new SimpleOperation(input), OPERATION_TAG);
//     }
// 
//     public final int runBroadcastTagged(@NonNull final String input) {
//         return runOperationBroadcast(new SimpleOperation(input), OPERATION_TAG);
//     }
// 
//     public final int runErrorSimple() {
//         return runOperation(new SimpleErrorOperation());
//     }
// 
//     public final int runErrorBroadcast() {
//         return runOperationBroadcast(new SimpleErrorOperation());
//     }
// 
//     public final boolean cancel(final int id) {
//         return cancelOperation(id);
//     }
// 
//     public final boolean cancelTagged() {
//         return cancelOperation(OPERATION_TAG);
//     }
// 
//     public final boolean isRunning(final int id) {
//         return isOperationRunning(id);
//     }
// 
//     public final boolean isRunningTagged() {
//         return isOperationRunning(OPERATION_TAG);
//     }
// 
//     public final int getResultObtained() {
//         return mResultObtained;
//     }
// 
//     @Contract(pure = true)
//     public final boolean gotResult() {
//         return mResultObtained > 0;
//     }
// 
//     @Contract(pure = true)
//     public final boolean gotBroadcastResult() {
//         return mBroadcastResultObtained > 0;
//     }
// 
//     @SuppressWarnings("UnusedDeclaration")
//     public final void onOperationFinished(final SimpleOperationResult result) {
//         mResultObtained++;
//         if (result.isSuccessful()) {
//             mResult = result.getOutput();
//         } else {
//             mError = result.getException();
//         }
//     }
// 
//     @SuppressWarnings("UnusedDeclaration")
//     public final void onBroadcastOperationFinished(final SimpleOperationResult result) {
//         mBroadcastResultObtained++;
//         if (result.isSuccessful()) {
//             mBroadcastResult = result.getOutput();
//         } else {
//             mBroadcastError = result.getException();
//         }
//     }
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/operation/SimpleErrorOperation.java
// public final class SimpleErrorOperation extends ChronosOperation<String> {
// 
//     private final static RuntimeException EXCEPTION = new RuntimeException("Test exception");
// 
//     @Contract("null -> false")
//     public static boolean isExpectedException(@Nullable final Exception exception) {
//         return exception != null && exception.equals(EXCEPTION);
//     }
// 
//     @Nullable
//     @Override
//     public String run() {
//         sleep(TestSettings.OPERATION_WAIT);
//         throw EXCEPTION;
//     }
// 
//     @NonNull
//     @Override
//     public Class<? extends ChronosOperationResult<String>> getResultClass() {
//         return SimpleOperationResult.class;
//     }
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/operation/SimpleOperation.java
// public final class SimpleOperation extends ChronosOperation<String> {
// 
//     private final String mInput;
// 
//     public SimpleOperation(@NonNull final String input) {
//         mInput = input;
//     }
// 
//     @Nullable
//     @Override
//     public String run() {
//         final String result = transform(mInput);
//         sleep(TestSettings.OPERATION_WAIT);
//         return result;
//     }
// 
//     public static boolean isTransform(@NonNull final String input, @Nullable final String output) {
//         return output != null && transform(input).equals(output);
//     }
// 
//     @NonNull
//     private static String transform(@NonNull final String input) {
//         return input.concat(input);
//     }
// 
//     @NonNull
//     @Override
//     public Class<? extends ChronosOperationResult<String>> getResultClass() {
//         return SimpleOperationResult.class;
//     }
// 
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/TestSettings.java
// public final static String INPUT = "test_input_string";
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/TestSettings.java
// public final static long SHORT_WAIT = 50L;
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/util/TimingUtils.java
// public static void sleep() {
//     try {
//         Thread.sleep(TestSettings.RESPONSE_WAIT);
//     } catch (InterruptedException e) {
//         //ignore it
//     }
// }


import com.redmadrobot.chronos.mock.gui.SimpleMockActivity;
import com.redmadrobot.chronos.mock.operation.SimpleErrorOperation;
import com.redmadrobot.chronos.mock.operation.SimpleOperation;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import static com.redmadrobot.chronos.TestSettings.INPUT;
import static com.redmadrobot.chronos.TestSettings.SHORT_WAIT;
import static com.redmadrobot.chronos.util.TimingUtils.sleep;
package com.redmadrobot.chronos;




/**
 * Test for operation runs in Activity.
 *
 * @author maximefimov
 */
public class ActivityRunTest extends AndroidTestCase {

    @SmallTest
    public void testNormalRun() {
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/gui/SimpleMockActivity.java
// public final class SimpleMockActivity extends MockActivity {
// 
//     private final static String OPERATION_TAG = "activity_operation_tag";
// 
//     private String mResult;
// 
//     private Exception mError;
// 
//     private String mBroadcastResult;
// 
//     private Exception mBroadcastError;
// 
//     private int mResultObtained = 0;
// 
//     private int mBroadcastResultObtained = 0;
// 
//     @Nullable
//     public String getResult() {
//         return mResult;
//     }
// 
//     @Nullable
//     public Exception getError() {
//         return mError;
//     }
// 
//     @Nullable
//     public String getBroadcastResult() {
//         return mBroadcastResult;
//     }
// 
//     @Nullable
//     public Exception getBroadcastError() {
//         return mBroadcastError;
//     }
// 
//     public int getBroadcastResultObtained() {
//         return mBroadcastResultObtained;
//     }
// 
//     public final int runSimple(@NonNull final String input) {
//         return runOperation(new SimpleOperation(input));
//     }
// 
//     public final int runBroadcast(@NonNull final String input) {
//         return runOperationBroadcast(new SimpleOperation(input));
//     }
// 
//     public final int runSimpleTagged(@NonNull final String input) {
//         return runOperation(new SimpleOperation(input), OPERATION_TAG);
//     }
// 
//     public final int runBroadcastTagged(@NonNull final String input) {
//         return runOperationBroadcast(new SimpleOperation(input), OPERATION_TAG);
//     }
// 
//     public final int runErrorSimple() {
//         return runOperation(new SimpleErrorOperation());
//     }
// 
//     public final int runErrorBroadcast() {
//         return runOperationBroadcast(new SimpleErrorOperation());
//     }
// 
//     public final boolean cancel(final int id) {
//         return cancelOperation(id);
//     }
// 
//     public final boolean cancelTagged() {
//         return cancelOperation(OPERATION_TAG);
//     }
// 
//     public final boolean isRunning(final int id) {
//         return isOperationRunning(id);
//     }
// 
//     public final boolean isRunningTagged() {
//         return isOperationRunning(OPERATION_TAG);
//     }
// 
//     public final int getResultObtained() {
//         return mResultObtained;
//     }
// 
//     @Contract(pure = true)
//     public final boolean gotResult() {
//         return mResultObtained > 0;
//     }
// 
//     @Contract(pure = true)
//     public final boolean gotBroadcastResult() {
//         return mBroadcastResultObtained > 0;
//     }
// 
//     @SuppressWarnings("UnusedDeclaration")
//     public final void onOperationFinished(final SimpleOperationResult result) {
//         mResultObtained++;
//         if (result.isSuccessful()) {
//             mResult = result.getOutput();
//         } else {
//             mError = result.getException();
//         }
//     }
// 
//     @SuppressWarnings("UnusedDeclaration")
//     public final void onBroadcastOperationFinished(final SimpleOperationResult result) {
//         mBroadcastResultObtained++;
//         if (result.isSuccessful()) {
//             mBroadcastResult = result.getOutput();
//         } else {
//             mBroadcastError = result.getException();
//         }
//     }
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/operation/SimpleErrorOperation.java
// public final class SimpleErrorOperation extends ChronosOperation<String> {
// 
//     private final static RuntimeException EXCEPTION = new RuntimeException("Test exception");
// 
//     @Contract("null -> false")
//     public static boolean isExpectedException(@Nullable final Exception exception) {
//         return exception != null && exception.equals(EXCEPTION);
//     }
// 
//     @Nullable
//     @Override
//     public String run() {
//         sleep(TestSettings.OPERATION_WAIT);
//         throw EXCEPTION;
//     }
// 
//     @NonNull
//     @Override
//     public Class<? extends ChronosOperationResult<String>> getResultClass() {
//         return SimpleOperationResult.class;
//     }
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/mock/operation/SimpleOperation.java
// public final class SimpleOperation extends ChronosOperation<String> {
// 
//     private final String mInput;
// 
//     public SimpleOperation(@NonNull final String input) {
//         mInput = input;
//     }
// 
//     @Nullable
//     @Override
//     public String run() {
//         final String result = transform(mInput);
//         sleep(TestSettings.OPERATION_WAIT);
//         return result;
//     }
// 
//     public static boolean isTransform(@NonNull final String input, @Nullable final String output) {
//         return output != null && transform(input).equals(output);
//     }
// 
//     @NonNull
//     private static String transform(@NonNull final String input) {
//         return input.concat(input);
//     }
// 
//     @NonNull
//     @Override
//     public Class<? extends ChronosOperationResult<String>> getResultClass() {
//         return SimpleOperationResult.class;
//     }
// 
// }
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/TestSettings.java
// public final static String INPUT = "test_input_string";
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/TestSettings.java
// public final static long SHORT_WAIT = 50L;
// 
// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/util/TimingUtils.java
// public static void sleep() {
//     try {
//         Thread.sleep(TestSettings.RESPONSE_WAIT);
//     } catch (InterruptedException e) {
//         //ignore it
//     }
// }


// Path: chronos/src/androidTest/java/com/redmadrobot/chronos/ActivityRunTest.java
import com.redmadrobot.chronos.mock.gui.SimpleMockActivity;
import com.redmadrobot.chronos.mock.operation.SimpleErrorOperation;
import com.redmadrobot.chronos.mock.operation.SimpleOperation;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import static com.redmadrobot.chronos.TestSettings.INPUT;
import static com.redmadrobot.chronos.TestSettings.SHORT_WAIT;
import static com.redmadrobot.chronos.util.TimingUtils.sleep;

package com.redmadrobot.chronos;




/**
 * Test for operation runs in Activity.
 *
 * @author maximefimov
 */
public class ActivityRunTest extends AndroidTestCase {

    @SmallTest
    public void testNormalRun() {
        final SimpleMockActivity activity = new SimpleMockActivity();