aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2015-07-16 16:38:51 -0700
committerKenny Root <kenny@the-b.org>2015-07-16 16:52:22 -0700
commit2abe2c43e2b7cf99dd2aaa5cff3e1ac6c646d678 (patch)
tree760ca1a479eacc14fb597dca4541460486687166
parentc22178e05b672f5c2beb498f4beb936f8d6acc45 (diff)
downloadconnectbot-2abe2c43e2b7cf99dd2aaa5cff3e1ac6c646d678.tar.gz
connectbot-2abe2c43e2b7cf99dd2aaa5cff3e1ac6c646d678.tar.bz2
connectbot-2abe2c43e2b7cf99dd2aaa5cff3e1ac6c646d678.zip
Update to Robolectric 3.0
This has better support for Android, so we don't need the separate project here anymore. Simply move all the existing robolectric-based tests to the app directory and remove the robolectric-tests subproject.
-rw-r--r--app/build.gradle10
-rw-r--r--app/src/test/java/org/connectbot/HostBeanTest.java (renamed from robolectric-tests/src/test/java/org/connectbot/HostBeanTest.java)6
-rw-r--r--app/src/test/java/org/connectbot/SelectionAreaTest.java (renamed from robolectric-tests/src/test/java/org/connectbot/SelectionAreaTest.java)6
-rw-r--r--app/src/test/java/org/connectbot/mock/BeanAssertions.java (renamed from robolectric-tests/src/test/java/org/connectbot/mock/BeanAssertions.java)0
-rw-r--r--app/src/test/java/org/connectbot/mock/NullOutputStream.java (renamed from robolectric-tests/src/test/java/org/connectbot/mock/NullOutputStream.java)0
-rw-r--r--app/src/test/java/org/connectbot/mock/NullTransport.java (renamed from robolectric-tests/src/test/java/org/connectbot/mock/NullTransport.java)0
-rw-r--r--app/src/test/java/org/connectbot/util/PubkeyUtilsTest.java (renamed from robolectric-tests/src/test/java/org/connectbot/util/PubkeyUtilsTest.java)7
-rw-r--r--robolectric-tests/.gitignore1
-rw-r--r--robolectric-tests/build.gradle48
-rw-r--r--robolectric-tests/robolectric-tests.iml76
-rw-r--r--settings.gradle2
11 files changed, 20 insertions, 136 deletions
diff --git a/app/build.gradle b/app/build.gradle
index a0fec85..9118576 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -41,7 +41,7 @@ android {
buildTypes {
release {
minifyEnabled true
- proguardFiles 'proguard.cfg'
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
if (project.hasProperty('keystorePassword')) {
signingConfig signingConfigs.release
@@ -54,6 +54,14 @@ android {
}
}
+dependencies {
+ testCompile 'junit:junit:4.12'
+ testCompile('org.robolectric:robolectric:3.0') {
+ exclude group: 'commons-logging', module: 'commons-logging'
+ exclude group: 'org.apache.httpcomponents', module: 'httpclient'
+ }
+}
+
if (project.hasProperty('keystorePassword')) {
android.signingConfigs.release.storeFile file(keystoreFile)
android.signingConfigs.release.storePassword keystorePassword
diff --git a/robolectric-tests/src/test/java/org/connectbot/HostBeanTest.java b/app/src/test/java/org/connectbot/HostBeanTest.java
index 2f8eb2f..ce52091 100644
--- a/robolectric-tests/src/test/java/org/connectbot/HostBeanTest.java
+++ b/app/src/test/java/org/connectbot/HostBeanTest.java
@@ -21,7 +21,7 @@ import org.connectbot.bean.HostBean;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertFalse;
@@ -32,8 +32,8 @@ import static org.connectbot.mock.BeanAssertions.assertMeetsHashCodeContract;
/**
* @author Kenny Root
*/
-@Config(manifest = "../app/src/main/AndroidManifest.xml", emulateSdk = 16)
-@RunWith(RobolectricTestRunner.class)
+@RunWith(RobolectricGradleTestRunner.class)
+@Config(constants = BuildConfig.class, sdk = 21)
public class HostBeanTest {
private static final String[] FIELDS = { "nickname", "username",
"hostname", "port" };
diff --git a/robolectric-tests/src/test/java/org/connectbot/SelectionAreaTest.java b/app/src/test/java/org/connectbot/SelectionAreaTest.java
index 6e4134a..23bc8eb 100644
--- a/robolectric-tests/src/test/java/org/connectbot/SelectionAreaTest.java
+++ b/app/src/test/java/org/connectbot/SelectionAreaTest.java
@@ -20,7 +20,7 @@ package org.connectbot;
import org.connectbot.bean.SelectionArea;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import static org.junit.Assert.assertFalse;
@@ -30,8 +30,8 @@ import static org.junit.Assert.assertTrue;
* @author Kenny Root
*
*/
-@Config(manifest = "../app/src/main/AndroidManifest.xml", emulateSdk = 16)
-@RunWith(RobolectricTestRunner.class)
+@RunWith(RobolectricGradleTestRunner.class)
+@Config(constants = BuildConfig.class, sdk = 21)
public class SelectionAreaTest {
private static final int WIDTH = 80;
private static final int HEIGHT = 24;
diff --git a/robolectric-tests/src/test/java/org/connectbot/mock/BeanAssertions.java b/app/src/test/java/org/connectbot/mock/BeanAssertions.java
index cf7b7de..cf7b7de 100644
--- a/robolectric-tests/src/test/java/org/connectbot/mock/BeanAssertions.java
+++ b/app/src/test/java/org/connectbot/mock/BeanAssertions.java
diff --git a/robolectric-tests/src/test/java/org/connectbot/mock/NullOutputStream.java b/app/src/test/java/org/connectbot/mock/NullOutputStream.java
index 79b8e72..79b8e72 100644
--- a/robolectric-tests/src/test/java/org/connectbot/mock/NullOutputStream.java
+++ b/app/src/test/java/org/connectbot/mock/NullOutputStream.java
diff --git a/robolectric-tests/src/test/java/org/connectbot/mock/NullTransport.java b/app/src/test/java/org/connectbot/mock/NullTransport.java
index d841e6a..d841e6a 100644
--- a/robolectric-tests/src/test/java/org/connectbot/mock/NullTransport.java
+++ b/app/src/test/java/org/connectbot/mock/NullTransport.java
diff --git a/robolectric-tests/src/test/java/org/connectbot/util/PubkeyUtilsTest.java b/app/src/test/java/org/connectbot/util/PubkeyUtilsTest.java
index 0843e74..f5bcc70 100644
--- a/robolectric-tests/src/test/java/org/connectbot/util/PubkeyUtilsTest.java
+++ b/app/src/test/java/org/connectbot/util/PubkeyUtilsTest.java
@@ -17,9 +17,10 @@
package org.connectbot.util;
+import org.connectbot.BuildConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;
import java.math.BigInteger;
@@ -39,8 +40,8 @@ import static org.junit.Assert.fail;
/**
* @author Kenny Root
*/
-@Config(manifest = "../app/src/main/AndroidManifest.xml", emulateSdk = 16)
-@RunWith(RobolectricTestRunner.class)
+@RunWith(RobolectricGradleTestRunner.class)
+@Config(constants = BuildConfig.class, sdk = 21)
public class PubkeyUtilsTest {
@Test
public void encodeHex_Null_Failure() throws Exception {
diff --git a/robolectric-tests/.gitignore b/robolectric-tests/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/robolectric-tests/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/robolectric-tests/build.gradle b/robolectric-tests/build.gradle
deleted file mode 100644
index 0cf5a7e..0000000
--- a/robolectric-tests/build.gradle
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * ConnectBot: simple, powerful, open-source SSH client for Android
- * Copyright 2014 Kenny Root, Jeffrey Sharkey
- *
- * Licensed 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.
- */
-
-apply plugin: 'java'
-
-evaluationDependsOn(':app')
-
-dependencies {
- def androidModule = project(':app')
- compile androidModule
-
- testCompile androidModule.android.applicationVariants.toList().first().javaCompile.classpath
- testCompile androidModule.android.applicationVariants.toList().first().javaCompile.outputs.files
- testCompile files(androidModule.android.getBootClasspath())
-
- // This gets the location of the SDK's Android Support Repo
- androidModule.repositories {
- all { ArtifactRepository repo ->
- if (repo.url.toString().contains("extras/android/m2repository")) {
- project.repositories.maven { url = repo.url }
- }
- }
- }
-
- testCompile 'junit:junit:4.10'
- testCompile 'org.robolectric:robolectric:2.3'
-}
-
-tasks.withType(Test) {
- scanForTestClasses = false
- include "**/*Should.class"
- include "**/*Test.class"
- include "**/*Tests.class"
-} \ No newline at end of file
diff --git a/robolectric-tests/robolectric-tests.iml b/robolectric-tests/robolectric-tests.iml
deleted file mode 100644
index 713cc09..0000000
--- a/robolectric-tests/robolectric-tests.iml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.id=":robolectric-tests" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="connectbot" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
- <component name="FacetManager">
- <facet type="android-gradle" name="Android-Gradle">
- <configuration>
- <option name="GRADLE_PROJECT_PATH" value=":robolectric-tests" />
- </configuration>
- </facet>
- <facet type="java-gradle" name="Java-Gradle">
- <configuration>
- <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
- <option name="BUILDABLE" value="true" />
- </configuration>
- </facet>
- </component>
- <component name="NewModuleRootManager" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/build/classes/main" />
- <output-test url="file://$MODULE_DIR$/build/classes/test" />
- <exclude-output />
- <content url="file://$MODULE_DIR$">
- <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
- <excludeFolder url="file://$MODULE_DIR$/.gradle" />
- <excludeFolder url="file://$MODULE_DIR$/build" />
- </content>
- <orderEntry type="inheritedJdk" />
- <orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module" module-name="app" exported="" />
- <orderEntry type="library" exported="" scope="TEST" name="junit-4.10" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="robolectric-2.3" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="objenesis-1.3" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="commons-logging-1.1.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="commons-codec-1.3" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="httpclient-4.0.3" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="support-v4-19.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="fest-util-1.2.5" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="fest-reflect-1.4.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="httpcore-4.0.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="classworlds-1.1-alpha-2" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="plexus-container-default-1.0-alpha-9-stable-1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="plexus-utils-1.5.15" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="plexus-interpolation-1.11" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-artifact-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-artifact-manager-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-model-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-project-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-error-diagnostics-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-settings-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="wagon-file-1.0-beta-6" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="wagon-http-lightweight-1.0-beta-6" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="wagon-provider-api-1.0-beta-6" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-repository-metadata-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="backport-util-concurrent-3.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-profile-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="maven-plugin-registry-2.2.1" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="wagon-http-shared-1.0-beta-6" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="xercesMinimal-1.9.6.2" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="nekohtml-1.9.6.2" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="_Users_kenny_git_connectbot_app_build_intermediates_classes_debug" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="_Users_kenny_git_connectbot_app_build_intermediates_dependency_cache_debug" level="project" />
- <orderEntry type="library" exported="" scope="TEST" name="android" level="project" />
- </component>
-</module> \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 61ac55a..e7b4def 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app', ':robolectric-tests'
+include ':app'