From c015b44aa70cd984cf920d00c0e486a0fe75bf94 Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 5 Jan 2016 17:34:03 +0100 Subject: [PATCH] Fixes for tests --- app/build.gradle | 25 +++++++++---------- .../AndroidCalculatorEditorViewTest.java | 8 ++++-- .../calculator/CalculatorBroadcasterTest.java | 2 +- .../calculator/CalculatorReceiverTest.java | 2 +- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7cc859f8..9e652ede 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ repositories { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(include: ['*.jar'], dir: 'libs') compile 'org.solovyev:common-core:1.0.7' compile 'org.solovyev:common-text:1.0.7' compile 'org.solovyev:common-security:1.0.7' @@ -87,29 +87,28 @@ dependencies { compile 'com.google.android.gms:play-services-analytics:8.4.0' compile 'com.melnykov:floatingactionbutton:1.1.0' compile(name: 'plotter', ext: 'aar') - debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' - compile group: 'org.solovyev', name: 'common-text', version: '1.0.7' - compile group: 'org.solovyev', name: 'common-listeners', version: '1.0.7' - compile(group: 'com.google.guava', name: 'guava', version: '11.0.2') { + compile 'org.solovyev:common-text:1.0.7' + compile 'org.solovyev:common-listeners:1.0.7' + compile('com.google.guava:guava:11.0.2') { exclude(module: 'jsr305') } - compile(group: 'org.solovyev', name: 'jscl', version: '1.0.11') { + compile('org.solovyev:jscl:1.0.11') { exclude(module: 'xercesImpl') } - compile(group: 'org.simpleframework', name: 'simple-xml', version: '2.6.1') { + compile('org.simpleframework:simple-xml:2.6.1') { exclude(module: 'stax-api') exclude(module: 'xpp3') } - compile group: 'commons-cli', name: 'commons-cli', version: '1.2' - testCompile group: 'junit', name: 'junit', version: '4.11' - testCompile group: 'net.sf.opencsv', name: 'opencsv', version: '2.0' - testCompile group: 'org.mockito', name: 'mockito-core', version: '1.9.0' - testCompile "org.robolectric:robolectric:3.0" + compile 'commons-cli:commons-cli:1.2' + testCompile 'junit:junit:4.11' + testCompile 'net.sf.opencsv:opencsv:2.0' + testCompile 'org.mockito:mockito-core:1.9.0' + testCompile 'org.robolectric:robolectric:3.0' testCompile 'org.mockito:mockito-all:1.9.5' testCompile 'org.skyscreamer:jsonassert:1.2.3' - testCompile (name: 'org.apache.http.legacy', ext: 'jar') + testCompile(name: 'org.apache.http.legacy', ext: 'jar') } tasks.withType(Test) { diff --git a/app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java b/app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java index 53e635a6..f0ae17a9 100644 --- a/app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java +++ b/app/src/test/java/org/solovyev/android/calculator/AndroidCalculatorEditorViewTest.java @@ -22,12 +22,15 @@ package org.solovyev.android.calculator; +import android.os.Build; + import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import org.solovyev.android.CalculatorTestRunner; +import org.robolectric.RobolectricGradleTestRunner; +import org.robolectric.annotation.Config; import org.solovyev.common.text.Strings; import java.util.Date; @@ -42,7 +45,8 @@ import java.util.concurrent.atomic.AtomicBoolean; * Time: 1:11 PM */ -@RunWith(value = CalculatorTestRunner.class) +@Config(constants = BuildConfig.class, sdk = Build.VERSION_CODES.LOLLIPOP_MR1) +@RunWith(value = RobolectricGradleTestRunner.class) public class AndroidCalculatorEditorViewTest { @BeforeClass diff --git a/app/src/test/java/org/solovyev/android/calculator/CalculatorBroadcasterTest.java b/app/src/test/java/org/solovyev/android/calculator/CalculatorBroadcasterTest.java index b1aade4a..48c58fe6 100644 --- a/app/src/test/java/org/solovyev/android/calculator/CalculatorBroadcasterTest.java +++ b/app/src/test/java/org/solovyev/android/calculator/CalculatorBroadcasterTest.java @@ -26,7 +26,7 @@ import static org.solovyev.android.calculator.CalculatorEventType.display_state_ import static org.solovyev.android.calculator.CalculatorEventType.editor_state_changed; import static org.solovyev.android.calculator.CalculatorEventType.editor_state_changed_light; -@Config(manifest = Config.NONE) +@Config(constants = BuildConfig.class) @RunWith(RobolectricGradleTestRunner.class) public class CalculatorBroadcasterTest { diff --git a/app/src/test/java/org/solovyev/android/calculator/CalculatorReceiverTest.java b/app/src/test/java/org/solovyev/android/calculator/CalculatorReceiverTest.java index 92cc6d29..16988905 100644 --- a/app/src/test/java/org/solovyev/android/calculator/CalculatorReceiverTest.java +++ b/app/src/test/java/org/solovyev/android/calculator/CalculatorReceiverTest.java @@ -17,7 +17,7 @@ import static org.solovyev.android.calculator.CalculatorReceiver.ACTION_BUTTON_I import static org.solovyev.android.calculator.CalculatorReceiver.ACTION_BUTTON_PRESSED; import static org.solovyev.android.calculator.CalculatorReceiver.newButtonClickedIntent; -@Config(manifest = Config.NONE) +@Config(constants = BuildConfig.class) @RunWith(RobolectricGradleTestRunner.class) public class CalculatorReceiverTest {