diff --git a/robolectric.gradle b/robolectric.gradle new file mode 100644 index 0000000..9521018 --- /dev/null +++ b/robolectric.gradle @@ -0,0 +1,50 @@ +android.testOptions.unitTests.all { + // configure the set of classes for JUnit tests + include project.hasProperty("testFilter") ? "**/*${project.ext.testFilter}*Test.class" : '**/*Test.class' + exclude '**/espresso/**/*.class' + + // configure max heap size of the test JVM + maxHeapSize = '2048m' + + // configure the test JVM arguments + jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier' + + // Specify max number of processes (default is 1) + maxParallelForks = 1 + + // Specify max number of test classes to execute in a test process + // before restarting the process (default is unlimited) + forkEvery = 150 + + // configure whether failing tests should fail the build + ignoreFailures false + + testLogging { + events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' + } +} + +ext { + assertjVersion = '1.1.1' + robolectricVersion = '3.0' +} + +dependencies { + testCompile "org.robolectric:robolectric:$robolectricVersion", + "org.robolectric:shadows-support-v4:$robolectricVersion", + 'org.mockito:mockito-core:1.9.5+', + 'junit:junit:4.12' + testCompile("com.squareup.assertj:assertj-android:$assertjVersion") { + exclude group: 'com.android.support', module: 'support-annotations' + } + testCompile("com.squareup.assertj:assertj-android-support-v4:$assertjVersion") { + exclude group: 'com.android.support', module: 'support-annotations' + exclude group: 'com.android.support', module: 'support-v4' + // see robolectric/robolectric#1633 + } + testCompile("com.squareup.assertj:assertj-android-appcompat-v7:$assertjVersion") { + exclude group: 'com.android.support', module: 'support-annotations' + exclude group: 'com.android.support', module: 'appcompat-v7' + // see robolectric/robolectric#1633 + } +} \ No newline at end of file diff --git a/stacklibrary/build.gradle b/stacklibrary/build.gradle index a42c23f..96e4607 100644 --- a/stacklibrary/build.gradle +++ b/stacklibrary/build.gradle @@ -24,8 +24,8 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' + apply from: "${rootProject.getRootDir()}/robolectric.gradle" } diff --git a/stacklibrary/src/main/res/layout/activity_main.xml b/stacklibrary/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..eaacbaa --- /dev/null +++ b/stacklibrary/src/main/res/layout/activity_main.xml @@ -0,0 +1,43 @@ + + + +