You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by sa...@apache.org on 2018/08/11 07:02:16 UTC

[1/3] incubator-taverna-mobile git commit: Added login activity UI test

Repository: incubator-taverna-mobile
Updated Branches:
  refs/heads/master d827f599a -> 775fe175a


Added login activity UI test


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/8cdbc03b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/8cdbc03b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/8cdbc03b

Branch: refs/heads/master
Commit: 8cdbc03bdf08ddc5ce1e25941d487ee944a8a031
Parents: d827f59
Author: Hitesh Gautam <ga...@gmail.com>
Authored: Fri Aug 10 22:31:05 2018 +0530
Committer: Hitesh Gautam <ga...@gmail.com>
Committed: Fri Aug 10 22:31:05 2018 +0530

----------------------------------------------------------------------
 app/build.gradle                                |  24 ++-
 .../taverna/mobile/TestComponentRule.java       | 103 +++++++++
 .../injection/component/TestComponent.java      |  31 +++
 .../injection/module/ApplicationTestModule.java |  62 ++++++
 .../taverna/mobile/login/LoginActivityTest.java | 208 +++++++++++++++++++
 .../mobile/runner/RxAndroidJUnitRunner.java     |  39 ++++
 .../runner/UnlockDeviceAndroidJUnitRunner.java  |  55 +++++
 .../mobile/utils/RxEspressoScheduleHandler.java |  52 +++++
 .../taverna/mobile/FakeRemoteDataSource.java    |   6 +
 .../org/apache/taverna/mobile/FakeXMLName.java  |   2 +-
 app/src/main/AndroidManifest.xml                |   2 +
 .../taverna/mobile/ui/DashboardActivity.java    |  69 ++++--
 .../taverna/mobile/TestComponentRule.java       |  67 ++++++
 .../injection/component/TestComponent.java      |  31 +++
 .../injection/module/ApplicationTestModule.java |  62 ++++++
 .../anouncements/AnnouncementPresenterTest.java |   1 +
 .../FavouriteWorkflowsPresenterTest.java        |   1 +
 .../ui/workflow/WorkflowPresenterTest.java      |   1 +
 .../mobile/utils/RxSchedulersOverrideRule.java  |  19 +-
 app/src/test/resources/user.xml                 |  12 ++
 build.gradle                                    |   5 +-
 21 files changed, 826 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/build.gradle
----------------------------------------------------------------------
diff --git a/app/build.gradle b/app/build.gradle
index ea848af..f64f473 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,6 +16,7 @@ android {
         versionCode 1
         versionName "1.0"
         multiDexEnabled true
+        testInstrumentationRunner 'org.apache.taverna.mobile.runner.RxAndroidJUnitRunner'
     }
 
     sourceSets {
@@ -125,11 +126,30 @@ dependencies {
 
     //Dependencies for JUNit and unit tests.
     testImplementation "junit:junit:4.12"
-    testImplementation "org.mockito:mockito-all:1.10.19"
+    testImplementation "org.mockito:mockito-core:2.8.47"
+
+    androidTestImplementation "junit:junit:4.12"
+    androidTestImplementation "org.mockito:mockito-core:2.8.47"
+
+    androidTestImplementation "org.mockito:mockito-android:2.8.47"
+    androidTestImplementation "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
+    androidTestImplementation("com.android.support.test.espresso:espresso-contrib:$rootProject.espresso") {
+        exclude group: 'com.android.support', module: 'appcompat'
+        exclude group: 'com.android.support', module: 'support-v4'
+        exclude group: 'com.android.support', module: 'recyclerview-v7'
+    }
+    androidTestImplementation "com.android.support.test.espresso:espresso-core:$rootProject.espresso"
+    androidTestImplementation ("com.android.support.test.espresso:espresso-intents:$rootProject.espresso")
+
+    androidTestImplementation "com.android.support.test:runner:$rootProject.runner"
+    androidTestImplementation "com.android.support.test:rules:$rootProject.runner"
 
     //Dependencies for Dagger 2
     implementation  "com.google.dagger:dagger:$rootProject.dagger"
+    testImplementation  "com.google.dagger:dagger:$rootProject.dagger"
+    androidTestImplementation  "com.google.dagger:dagger:$rootProject.dagger"
     annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
-
+    androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
+    testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger"
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java b/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java
new file mode 100644
index 0000000..9c5b5f8
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/TestComponentRule.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+import org.apache.taverna.mobile.data.DataManager;
+import org.apache.taverna.mobile.injection.component.DaggerTestComponent;
+import org.apache.taverna.mobile.injection.component.TestComponent;
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import android.content.Context;
+
+import java.util.concurrent.Callable;
+
+import io.reactivex.Scheduler;
+import io.reactivex.android.plugins.RxAndroidPlugins;
+import io.reactivex.functions.Function;
+import io.reactivex.plugins.RxJavaPlugins;
+import io.reactivex.schedulers.Schedulers;
+
+public class TestComponentRule implements TestRule {
+
+    private final TestComponent mTestComponent;
+    private final Context mContext;
+
+    private Scheduler schedulerInstance = Schedulers.trampoline();
+
+    private Function<Scheduler, Scheduler> schedulerMapper = new Function<Scheduler, Scheduler>() {
+        @Override
+        public Scheduler apply(Scheduler scheduler) throws Exception {
+            return schedulerInstance;
+        }
+    };
+    private Function<Callable<Scheduler>, Scheduler> schedulerMapperLazy =
+            new Function<Callable<Scheduler>, Scheduler>() {
+
+
+        @Override
+        public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
+            return schedulerInstance;
+        }
+    };
+
+    public TestComponentRule(Context context) {
+        mContext = context;
+        TavernaApplication application = TavernaApplication.get(context);
+        mTestComponent = DaggerTestComponent.builder()
+                .applicationTestModule(new ApplicationTestModule(application))
+                .build();
+    }
+
+    public Context getContext() {
+        return mContext;
+    }
+
+    public DataManager getMockDataManager() {
+        return mTestComponent.dataManager();
+    }
+
+    @Override
+    public Statement apply(final Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                RxAndroidPlugins.reset();
+                RxAndroidPlugins.setInitMainThreadSchedulerHandler(schedulerMapperLazy);
+
+                RxJavaPlugins.reset();
+                RxJavaPlugins.setIoSchedulerHandler(schedulerMapper);
+                RxJavaPlugins.setNewThreadSchedulerHandler(schedulerMapper);
+                RxJavaPlugins.setComputationSchedulerHandler(schedulerMapper);
+
+                TavernaApplication application = TavernaApplication.get(mContext);
+                application.setComponent(mTestComponent);
+
+                base.evaluate();
+                application.setComponent(null);
+                RxAndroidPlugins.reset();
+                RxJavaPlugins.reset();
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java b/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java
new file mode 100644
index 0000000..76ac0e8
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/injection/component/TestComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.component;
+
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+
+import javax.inject.Singleton;
+
+import dagger.Component;
+
+@Singleton
+@Component(modules = ApplicationTestModule.class)
+public interface TestComponent extends ApplicationComponent {
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java b/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
new file mode 100644
index 0000000..e8a683f
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.module;
+
+import org.apache.taverna.mobile.data.DataManager;
+import org.apache.taverna.mobile.injection.ApplicationContext;
+import org.mockito.Mockito;
+
+import android.app.Application;
+import android.content.Context;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+@Module
+public class ApplicationTestModule {
+
+    private final Application mApplication;
+
+    public ApplicationTestModule(Application application) {
+        mApplication = application;
+    }
+
+    @Provides
+    Application provideApplication() {
+        return mApplication;
+    }
+
+    @Provides
+    @ApplicationContext
+    Context provideContext() {
+        return mApplication;
+    }
+
+    /************* MOCKS *************/
+
+    @Provides
+    @Singleton
+    DataManager provideDataManager() {
+        return Mockito.mock(DataManager.class);
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
new file mode 100644
index 0000000..acc2e8a
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.login;
+
+import org.apache.taverna.mobile.FakeRemoteDataSource;
+import org.apache.taverna.mobile.TestComponentRule;
+
+import org.apache.taverna.mobile.R;
+
+import org.apache.taverna.mobile.data.model.User;
+import org.apache.taverna.mobile.ui.login.LoginActivity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.espresso.Espresso;
+import android.support.test.rule.ActivityTestRule;
+import android.support.test.runner.AndroidJUnit4;
+
+import io.reactivex.Observable;
+
+import static android.os.SystemClock.sleep;
+import static android.support.test.espresso.Espresso.onView;
+import static android.support.test.espresso.action.ViewActions.click;
+import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
+import static android.support.test.espresso.action.ViewActions.typeText;
+import static android.support.test.espresso.assertion.ViewAssertions.matches;
+import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import static android.support.test.espresso.matcher.ViewMatchers.withText;
+import static org.hamcrest.core.AllOf.allOf;
+
+@RunWith(AndroidJUnit4.class)
+public class LoginActivityTest {
+
+    User testUser;
+
+    @Rule
+    public ActivityTestRule<LoginActivity> mActivityTestRule
+            = new ActivityTestRule<>(LoginActivity.class);
+
+    public final TestComponentRule component =
+            new TestComponentRule(InstrumentationRegistry.getTargetContext());
+    public final ActivityTestRule<LoginActivity> mLoginActivityActivityTestRule =
+            new ActivityTestRule<LoginActivity>(LoginActivity.class, false, false) {
+                @Override
+                protected Intent getActivityIntent() {
+                    /**
+                     * Override the default intent so we pass a false flag for syncing so it doesn't
+                     * start a sync service in the background that would affect  the behaviour of
+                     * this test.
+                     */
+                    return new Intent(InstrumentationRegistry.getTargetContext(), LoginActivity
+                            .class);
+                }
+            };
+
+    /**
+     * TestComponentRule needs to go first to make sure the Dagger ApplicationTestComponent is set
+     * in the Application before any Activity is launched.
+     */
+    @Rule
+    public final TestRule chain = RuleChain.outerRule(component)
+            .around(mLoginActivityActivityTestRule);
+
+    @Before
+    public void setUp() {
+        testUser = FakeRemoteDataSource.getLoginUser();
+    }
+
+    /**
+     * Checks if all the views are visible on the login activity
+     */
+    @Test
+    public void checkAllViewAreVisible() throws Exception {
+        onView(withId(R.id.logo)).check(matches(isDisplayed()));
+        onView(withId(R.id.tvAppName)).check(matches(withText(R.string.app_name)));
+        onView(withId(R.id.loginlayout)).check(matches(isDisplayed()));
+        onView(withId(R.id.myExperimentIcon)).check(matches(isDisplayed()));
+        onView(withId(R.id.input_layout_email)).check(matches(isDisplayed()));
+        onView(withId(R.id.input_layout_password)).check(matches(isDisplayed()));
+        onView(withId(R.id.etEmail)).check(matches(isDisplayed()));
+        onView(withId(R.id.etPassword)).check(matches(isDisplayed()));
+        Espresso.closeSoftKeyboard();
+        onView(withId(R.id.bLogin)).check(matches(isDisplayed()));
+        onView(withId(R.id.bRegister)).check(matches(isDisplayed()));
+    }
+
+    /**
+     * This test demonstrates that when user enters the invalid username and password both then
+     * it verify if the correct snackbar is shown or not
+     */
+    @Test
+    public void invalidLoginCredentials_showErrorSnackBar() throws Exception {
+
+        testUser = new User();
+        Mockito.when(component.getMockDataManager()
+                .getLoginUserDetail("Basic cG9zdG1hbjpwYXNzd29yZA==", true))
+                .thenReturn(Observable.just(testUser))
+                .thenThrow(new RuntimeException("runtime exception"));
+        mLoginActivityActivityTestRule.launchActivity(null);
+
+        onView(withId(R.id.etEmail))
+                .perform(typeText("postman"), closeSoftKeyboard());
+        onView(withId(R.id.etPassword))
+                .perform(typeText("password"), closeSoftKeyboard());
+
+        onView(withId(R.id.bLogin)).perform(click());
+
+        onView(allOf(withId(android.support.design.R.id.snackbar_text),
+                withText("Please enter valid credential")))
+                .check(matches(isDisplayed()));
+    }
+
+    /**
+     * This test demonstrates that when user enters the valid/invalid password and empty username
+     * then it verify if the correct snackbar is shown or not
+     */
+    @Test
+    public void emptyUsername_invalidCredentials_showErrorSnackBar() throws Exception {
+
+        testUser = new User();
+        Mockito.when(component.getMockDataManager()
+                .getLoginUserDetail("Basic OnRlc3QNCg==", true))
+                .thenReturn(Observable.just(testUser));
+        mLoginActivityActivityTestRule.launchActivity(null);
+
+        onView(withId(R.id.etEmail))
+                .perform(typeText(""), closeSoftKeyboard());
+        onView(withId(R.id.etPassword))
+                .perform(typeText("test"), closeSoftKeyboard());
+        onView(withId(R.id.bLogin)).perform(click());
+        sleep(2000);
+
+        onView(allOf(withId(android.support.design.R.id.snackbar_text),
+                withText("Please enter valid credential")))
+                .check(matches(isDisplayed()));
+    }
+
+    /**
+     * This test demonstrates that when user enters the valid/invalid username and empty password
+     * then it verify if the correct snackbar is shown or not
+     */
+    @Test
+    public void invalidPassword_invalidLoginCredentials_showErrorSnackBar() throws Exception {
+
+        testUser = new User();
+        Mockito.when(component.getMockDataManager()
+                .getLoginUserDetail("Basic dGVzdDoNCg==", true))
+                .thenReturn(Observable.just(testUser));
+        mLoginActivityActivityTestRule.launchActivity(null);
+
+        onView(withId(R.id.etEmail))
+                .perform(typeText("test"), closeSoftKeyboard());
+        onView(withId(R.id.etPassword))
+                .perform(typeText(""), closeSoftKeyboard());
+
+        onView(withId(R.id.bLogin)).perform(click());
+        sleep(2000);
+
+        onView(allOf(withId(android.support.design.R.id.snackbar_text),
+                withText("Please enter valid credential")))
+                .check(matches(isDisplayed()));
+    }
+
+    /**
+     * This test demonstrates that when user does not enters anything inside the username
+     * and password then it verify if the correct snackbar is shown or not
+     */
+    @Test
+    public void nullLoginCredentials_showErrorSnackBar() throws Exception {
+
+        mLoginActivityActivityTestRule.launchActivity(null);
+
+        onView(withId(R.id.etEmail))
+                .perform(typeText(""), closeSoftKeyboard());
+        onView(withId(R.id.etPassword))
+                .perform(typeText(""), closeSoftKeyboard());
+
+        onView(withId(R.id.bLogin)).perform(click());
+
+        onView(allOf(withId(android.support.design.R.id.snackbar_text),
+                withText("Please enter valid credential")))
+                .check(matches(isDisplayed()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java b/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java
new file mode 100644
index 0000000..42b320c
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/runner/RxAndroidJUnitRunner.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.runner;
+
+import org.apache.taverna.mobile.utils.RxEspressoScheduleHandler;
+
+import android.os.Bundle;
+import android.support.test.espresso.Espresso;
+
+import io.reactivex.plugins.RxJavaPlugins;
+
+public class RxAndroidJUnitRunner extends UnlockDeviceAndroidJUnitRunner {
+
+    @Override
+    public void onCreate(Bundle arguments) {
+        super.onCreate(arguments);
+
+        RxEspressoScheduleHandler rxEspressoScheduleHandler = new RxEspressoScheduleHandler();
+        RxJavaPlugins.setScheduleHandler(rxEspressoScheduleHandler);
+        Espresso.registerIdlingResources(rxEspressoScheduleHandler.getIdlingResource());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java b/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java
new file mode 100644
index 0000000..9760a4a
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/runner/UnlockDeviceAndroidJUnitRunner.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.runner;
+
+import android.annotation.SuppressLint;
+import android.app.Application;
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.os.PowerManager;
+import android.support.test.runner.AndroidJUnitRunner;
+
+public class UnlockDeviceAndroidJUnitRunner extends AndroidJUnitRunner {
+
+    private PowerManager.WakeLock mWakeLock;
+
+    @SuppressLint("MissingPermission")
+    @Override
+    public void onStart() {
+        Application application = (Application) getTargetContext().getApplicationContext();
+        String simpleName = UnlockDeviceAndroidJUnitRunner.class.getSimpleName();
+        // Unlock the device so that the tests can input keystrokes.
+        ((KeyguardManager) application.getSystemService(Context.KEYGUARD_SERVICE))
+                .newKeyguardLock(simpleName)
+                .disableKeyguard();
+        // Wake up the screen.
+        PowerManager powerManager = ((PowerManager) application.getSystemService(Context
+                .POWER_SERVICE));
+        mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK |
+                PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, simpleName);
+        mWakeLock.acquire();
+        super.onStart();
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        mWakeLock.release();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java
new file mode 100644
index 0000000..9c60972
--- /dev/null
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/utils/RxEspressoScheduleHandler.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.utils;
+
+import android.support.annotation.NonNull;
+import android.support.test.espresso.IdlingResource;
+import android.support.test.espresso.contrib.CountingIdlingResource;
+
+
+import io.reactivex.functions.Function;
+public class RxEspressoScheduleHandler implements Function<Runnable, Runnable> {
+
+    private final CountingIdlingResource mCountingIdlingResource =
+            new CountingIdlingResource("rxJava");
+
+    @Override
+    public Runnable apply(@NonNull final Runnable runnable) throws Exception {
+        return new Runnable() {
+            @Override
+            public void run() {
+                mCountingIdlingResource.increment();
+
+                try {
+                    runnable.run();
+                } finally {
+                    mCountingIdlingResource.decrement();
+                }
+            }
+        };
+    }
+
+    public IdlingResource getIdlingResource() {
+        return mCountingIdlingResource;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
----------------------------------------------------------------------
diff --git a/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java b/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
index 3058152..adb1054 100644
--- a/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
+++ b/app/src/commonTest/java/org/apache/taverna/mobile/FakeRemoteDataSource.java
@@ -2,6 +2,7 @@ package org.apache.taverna.mobile;
 
 import org.apache.taverna.mobile.data.model.Announcements;
 import org.apache.taverna.mobile.data.model.DetailAnnouncement;
+import org.apache.taverna.mobile.data.model.User;
 import org.apache.taverna.mobile.data.model.Workflows;
 
 public class FakeRemoteDataSource {
@@ -22,4 +23,9 @@ public class FakeRemoteDataSource {
     public static Workflows getWorkflowList() {
         return mTestDataFactory.getObjectTypeBean(Workflows.class, FakeXMLName.WORKFLOWS_XML);
     }
+
+
+    public static User getLoginUser() {
+        return mTestDataFactory.getObjectTypeBean(User.class, FakeXMLName.USER_XML);
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
----------------------------------------------------------------------
diff --git a/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java b/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
index eaeeaec..749ec45 100644
--- a/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
+++ b/app/src/commonTest/java/org/apache/taverna/mobile/FakeXMLName.java
@@ -5,5 +5,5 @@ public class FakeXMLName {
     public static final String ANNOUNCEMENTS_XML = "announcements.xml";
     public static final String ANNOUNCEMENT_XML = "announcement.xml";
     public static final String WORKFLOWS_XML = "workflows.xml";
-
+    public static final String USER_XML = "user.xml";
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/main/AndroidManifest.xml
----------------------------------------------------------------------
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1290302..950d7d8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,6 +24,8 @@ limitations under the License.
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
+    <uses-permission android:name="android.permission.WAKE_LOCK"/>
 
     <application
             android:name=".TavernaApplication"

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
----------------------------------------------------------------------
diff --git a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
index f9a4ae2..60b3316 100644
--- a/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
+++ b/app/src/main/java/org/apache/taverna/mobile/ui/DashboardActivity.java
@@ -281,29 +281,57 @@ public class DashboardActivity extends BaseActivity {
     private void setNavHeader() {
 
         View headerView =  navigationView.getHeaderView(0);
-        String avatarUrl = dataManager.getPreferencesHelper().getUserAvatarUrl();
         final CircleImageView navUserAvatar = headerView.findViewById(R.id.nav_user_avatar);
 
-        Glide.with(getContext())
-                .load(avatarUrl)
-                .diskCacheStrategy(DiskCacheStrategy.SOURCE)
-                .placeholder(R.drawable.ic_account_circle_black_24dp)
-                .error(R.drawable.ic_account_circle_black_24dp)
-                .into(new SimpleTarget<GlideDrawable>() {
-                    @Override
-                    public void onResourceReady(GlideDrawable resource, GlideAnimation<?
-                            super GlideDrawable> glideAnimation) {
-                        navUserAvatar.setImageDrawable(resource);
-                    }
-                });
+        if (dataManager.getPreferencesHelper().getUserAvatarUrl() != null) {
+
+            String avatarUrl = dataManager.getPreferencesHelper().getUserAvatarUrl();
+
+            Glide.with(getContext())
+                    .load(avatarUrl)
+                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
+                    .placeholder(R.drawable.ic_account_circle_black_24dp)
+                    .error(R.drawable.ic_account_circle_black_24dp)
+                    .into(new SimpleTarget<GlideDrawable>() {
+                        @Override
+                        public void onResourceReady(GlideDrawable resource, GlideAnimation<?
+                                super GlideDrawable> glideAnimation) {
+                            navUserAvatar.setImageDrawable(resource);
+                        }
+                    });
+
+            navUserAvatar.setOnClickListener(new View.OnClickListener() {
+                @OnClick
+                public void onClick(View v) {
+                    Intent intent = new Intent(DashboardActivity.this, UserProfileActivity.class);
+                    startActivity(intent);
+                }
+            });
+        } else {
 
-        navUserAvatar.setOnClickListener(new View.OnClickListener() {
-            @OnClick
-            public void onClick(View v) {
-                Intent intent = new Intent(DashboardActivity.this, UserProfileActivity.class);
-                startActivity(intent);
-            }
-        });
+            String avatarUrl = "http://www.myexperiment.org/images/avatar.png";
+
+            Glide.with(getContext())
+                    .load(avatarUrl)
+                    .diskCacheStrategy(DiskCacheStrategy.SOURCE)
+                    .placeholder(R.drawable.ic_account_circle_black_24dp)
+                    .error(R.drawable.ic_account_circle_black_24dp)
+                    .into(new SimpleTarget<GlideDrawable>() {
+                        @Override
+                        public void onResourceReady(GlideDrawable resource, GlideAnimation<?
+                                super GlideDrawable> glideAnimation) {
+                            navUserAvatar.setImageDrawable(resource);
+                        }
+                    });
+
+            navUserAvatar.setOnClickListener(new View.OnClickListener() {
+                @OnClick
+                public void onClick(View v) {
+                    Intent intent = new Intent(DashboardActivity.this, UserProfileActivity.class);
+                    startActivity(intent);
+                }
+            });
+        }
 
         String userName = dataManager.getPreferencesHelper().getUserName();
         TextView navUserName = headerView.findViewById(R.id.nav_user_name);
@@ -315,7 +343,6 @@ public class DashboardActivity extends BaseActivity {
 
     }
 
-
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         switch (item.getItemId()) {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/TestComponentRule.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/TestComponentRule.java b/app/src/test/java/org/apache/taverna/mobile/TestComponentRule.java
new file mode 100644
index 0000000..4b56791
--- /dev/null
+++ b/app/src/test/java/org/apache/taverna/mobile/TestComponentRule.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile;
+
+
+import org.apache.taverna.mobile.data.DataManager;
+
+import org.apache.taverna.mobile.injection.component.DaggerTestComponent;
+import org.apache.taverna.mobile.injection.component.TestComponent;
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+
+import android.content.Context;
+
+public class TestComponentRule implements TestRule {
+
+    private final TestComponent mTestComponent;
+    private final Context mContext;
+
+    public TestComponentRule(Context context) {
+        mContext = context;
+        TavernaApplication application = TavernaApplication.get(context);
+        mTestComponent = DaggerTestComponent.builder()
+                .applicationTestModule(new ApplicationTestModule(application))
+                .build();
+    }
+
+    public Context getContext() {
+        return mContext;
+    }
+
+    public DataManager getMockDataManager() {
+        return mTestComponent.dataManager();
+    }
+
+    @Override
+    public Statement apply(final Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                TavernaApplication application = TavernaApplication.get(mContext);
+                application.setComponent(mTestComponent);
+                base.evaluate();
+                application.setComponent(null);
+            }
+        };
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/injection/component/TestComponent.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/injection/component/TestComponent.java b/app/src/test/java/org/apache/taverna/mobile/injection/component/TestComponent.java
new file mode 100644
index 0000000..76ac0e8
--- /dev/null
+++ b/app/src/test/java/org/apache/taverna/mobile/injection/component/TestComponent.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.component;
+
+import org.apache.taverna.mobile.injection.module.ApplicationTestModule;
+
+import javax.inject.Singleton;
+
+import dagger.Component;
+
+@Singleton
+@Component(modules = ApplicationTestModule.class)
+public interface TestComponent extends ApplicationComponent {
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java b/app/src/test/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
new file mode 100644
index 0000000..e8a683f
--- /dev/null
+++ b/app/src/test/java/org/apache/taverna/mobile/injection/module/ApplicationTestModule.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.taverna.mobile.injection.module;
+
+import org.apache.taverna.mobile.data.DataManager;
+import org.apache.taverna.mobile.injection.ApplicationContext;
+import org.mockito.Mockito;
+
+import android.app.Application;
+import android.content.Context;
+
+import javax.inject.Singleton;
+
+import dagger.Module;
+import dagger.Provides;
+
+@Module
+public class ApplicationTestModule {
+
+    private final Application mApplication;
+
+    public ApplicationTestModule(Application application) {
+        mApplication = application;
+    }
+
+    @Provides
+    Application provideApplication() {
+        return mApplication;
+    }
+
+    @Provides
+    @ApplicationContext
+    Context provideContext() {
+        return mApplication;
+    }
+
+    /************* MOCKS *************/
+
+    @Provides
+    @Singleton
+    DataManager provideDataManager() {
+        return Mockito.mock(DataManager.class);
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/ui/anouncements/AnnouncementPresenterTest.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/ui/anouncements/AnnouncementPresenterTest.java b/app/src/test/java/org/apache/taverna/mobile/ui/anouncements/AnnouncementPresenterTest.java
index 0f08d18..716d0b8 100644
--- a/app/src/test/java/org/apache/taverna/mobile/ui/anouncements/AnnouncementPresenterTest.java
+++ b/app/src/test/java/org/apache/taverna/mobile/ui/anouncements/AnnouncementPresenterTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.taverna.mobile.ui.anouncements;
 
+
 import org.apache.taverna.mobile.FakeRemoteDataSource;
 import org.apache.taverna.mobile.R;
 import org.apache.taverna.mobile.data.DataManager;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/ui/favouriteworkflow/FavouriteWorkflowsPresenterTest.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/ui/favouriteworkflow/FavouriteWorkflowsPresenterTest.java b/app/src/test/java/org/apache/taverna/mobile/ui/favouriteworkflow/FavouriteWorkflowsPresenterTest.java
index 1d58bdc..2fecf78 100644
--- a/app/src/test/java/org/apache/taverna/mobile/ui/favouriteworkflow/FavouriteWorkflowsPresenterTest.java
+++ b/app/src/test/java/org/apache/taverna/mobile/ui/favouriteworkflow/FavouriteWorkflowsPresenterTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.taverna.mobile.ui.favouriteworkflow;
 
+
 import org.apache.taverna.mobile.FakeRemoteDataSource;
 import org.apache.taverna.mobile.data.DataManager;
 import org.apache.taverna.mobile.data.model.Workflow;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java b/app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java
index 591b040..205aeba 100644
--- a/app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java
+++ b/app/src/test/java/org/apache/taverna/mobile/ui/workflow/WorkflowPresenterTest.java
@@ -1,5 +1,6 @@
 package org.apache.taverna.mobile.ui.workflow;
 
+
 import org.apache.taverna.mobile.FakeRemoteDataSource;
 import org.apache.taverna.mobile.R;
 import org.apache.taverna.mobile.data.DataManager;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/java/org/apache/taverna/mobile/utils/RxSchedulersOverrideRule.java
----------------------------------------------------------------------
diff --git a/app/src/test/java/org/apache/taverna/mobile/utils/RxSchedulersOverrideRule.java b/app/src/test/java/org/apache/taverna/mobile/utils/RxSchedulersOverrideRule.java
index b6be49f..3016a90 100644
--- a/app/src/test/java/org/apache/taverna/mobile/utils/RxSchedulersOverrideRule.java
+++ b/app/src/test/java/org/apache/taverna/mobile/utils/RxSchedulersOverrideRule.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
 package org.apache.taverna.mobile.utils;
 
 import org.junit.rules.TestRule;
@@ -12,7 +30,6 @@ import io.reactivex.functions.Function;
 import io.reactivex.plugins.RxJavaPlugins;
 import io.reactivex.schedulers.Schedulers;
 
-
 public class RxSchedulersOverrideRule implements TestRule {
 
     private final Function<Callable<Scheduler>, Scheduler> mRxAndroidSchedulersHook =

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/app/src/test/resources/user.xml
----------------------------------------------------------------------
diff --git a/app/src/test/resources/user.xml b/app/src/test/resources/user.xml
new file mode 100644
index 0000000..d4542b9
--- /dev/null
+++ b/app/src/test/resources/user.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<user uri="http://www.myexperiment.org/user.xml?id=65265" resource="http://www.myexperiment.org/users/65265" id="65265">
+    <id>65265</id>
+    <created-at>2016-04-27 04:48:05 UTC</created-at>
+    <name>Sagar Sagar</name>
+    <description/>
+    <email/>
+    <avatar resource="http://www.myexperiment.org/images/avatar.png"/>
+    <city/>
+    <country/>
+    <website/>
+</user>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/8cdbc03b/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index dd2a26b..7326a5d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -40,7 +40,7 @@ ext {
     buildToolsVersion = '27.0.3'
 
     // App dependencies
-    rxJava2Version = '2.0.1'
+    rxJava2Version = '2.0.2'
     supportLibraryVersion = '27.0.2'
     raizLabsDBFlow = '3.1.1'
     retrofitVersionLatest = '2.3.0'
@@ -49,4 +49,7 @@ ext {
     stetho='1.5.0'
     leakcanary ='1.5.4'
     dagger='2.8'
+
+    espresso = '2.2.1'
+    runner = '0.4'
 }
\ No newline at end of file


[2/3] incubator-taverna-mobile git commit: fix the exception test.

Posted by sa...@apache.org.
fix the exception test.


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/155eba6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/155eba6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/155eba6d

Branch: refs/heads/master
Commit: 155eba6deb4a0c73c0f160c6d111b4381a320538
Parents: 8cdbc03
Author: Sagar <ku...@gmail.com>
Authored: Sat Aug 11 12:16:59 2018 +0530
Committer: Sagar <ku...@gmail.com>
Committed: Sat Aug 11 12:16:59 2018 +0530

----------------------------------------------------------------------
 .../java/org/apache/taverna/mobile/login/LoginActivityTest.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/155eba6d/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
index acc2e8a..c6b268f 100644
--- a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
@@ -40,11 +40,13 @@ import android.support.test.rule.ActivityTestRule;
 import android.support.test.runner.AndroidJUnit4;
 
 import io.reactivex.Observable;
+import retrofit2.HttpException;
 
 import static android.os.SystemClock.sleep;
 import static android.support.test.espresso.Espresso.onView;
 import static android.support.test.espresso.action.ViewActions.click;
 import static android.support.test.espresso.action.ViewActions.closeSoftKeyboard;
+import static android.support.test.espresso.action.ViewActions.scrollTo;
 import static android.support.test.espresso.action.ViewActions.typeText;
 import static android.support.test.espresso.assertion.ViewAssertions.matches;
 import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
@@ -118,8 +120,7 @@ public class LoginActivityTest {
         testUser = new User();
         Mockito.when(component.getMockDataManager()
                 .getLoginUserDetail("Basic cG9zdG1hbjpwYXNzd29yZA==", true))
-                .thenReturn(Observable.just(testUser))
-                .thenThrow(new RuntimeException("runtime exception"));
+                .thenReturn(Observable.<User>error(new Throwable()));
         mLoginActivityActivityTestRule.launchActivity(null);
 
         onView(withId(R.id.etEmail))


[3/3] incubator-taverna-mobile git commit: fix issue with modifiers

Posted by sa...@apache.org.
fix issue with modifiers


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/commit/775fe175
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/tree/775fe175
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/diff/775fe175

Branch: refs/heads/master
Commit: 775fe175ac1bd8659062f66c4a6081c59763f762
Parents: 155eba6
Author: Sagar <ku...@gmail.com>
Authored: Sat Aug 11 12:24:26 2018 +0530
Committer: Sagar <ku...@gmail.com>
Committed: Sat Aug 11 12:24:26 2018 +0530

----------------------------------------------------------------------
 .../taverna/mobile/login/LoginActivityTest.java      | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-mobile/blob/775fe175/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
----------------------------------------------------------------------
diff --git a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
index c6b268f..d58a13c 100644
--- a/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
+++ b/app/src/androidTest/java/org/apache/taverna/mobile/login/LoginActivityTest.java
@@ -57,23 +57,16 @@ import static org.hamcrest.core.AllOf.allOf;
 @RunWith(AndroidJUnit4.class)
 public class LoginActivityTest {
 
-    User testUser;
+    private User testUser;
 
-    @Rule
-    public ActivityTestRule<LoginActivity> mActivityTestRule
-            = new ActivityTestRule<>(LoginActivity.class);
 
-    public final TestComponentRule component =
+    private final TestComponentRule component =
             new TestComponentRule(InstrumentationRegistry.getTargetContext());
-    public final ActivityTestRule<LoginActivity> mLoginActivityActivityTestRule =
+    private final ActivityTestRule<LoginActivity> mLoginActivityActivityTestRule =
             new ActivityTestRule<LoginActivity>(LoginActivity.class, false, false) {
                 @Override
                 protected Intent getActivityIntent() {
-                    /**
-                     * Override the default intent so we pass a false flag for syncing so it doesn't
-                     * start a sync service in the background that would affect  the behaviour of
-                     * this test.
-                     */
+
                     return new Intent(InstrumentationRegistry.getTargetContext(), LoginActivity
                             .class);
                 }