Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 3ac31c1

Browse files
author
Denis Sologub
committed
Updates dependencies for tests
1 parent 974c500 commit 3ac31c1

6 files changed

Lines changed: 29 additions & 3 deletions

File tree

library/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ android {
77
compileSdkVersion 28
88
buildToolsVersion '28.0.3'
99

10+
// Gradle automatically adds 'android.test.runner' as a dependency.
11+
useLibrary 'android.test.runner'
12+
1013
dataBinding {
1114
enabled true
1215
}
@@ -17,14 +20,22 @@ android {
1720
versionCode 3
1821
versionName "1.0.0"
1922
consumerProguardFiles 'proguard-rules.pro'
23+
24+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2025
}
2126
}
2227

2328
dependencies {
2429
implementation fileTree(dir: 'libs', include: ['*.jar'])
2530
api 'androidx.appcompat:appcompat:1.0.0'
2631
api 'com.google.android.material:material:1.0.0'
32+
// JUnit 4 framework
2733
testImplementation 'junit:junit:4.12'
34+
// Android annotations
35+
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
36+
// AndroidJUnitRunner and JUnit Rules
37+
androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
38+
androidTestImplementation 'androidx.test:rules:1.1.0-beta02'
2839
}
2940

3041
// build a jar with source files

library/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
package="br.com.ilhasoft.support.validation">
44

55
<application android:allowBackup="true"
6-
android:supportsRtl="true" />
6+
android:supportsRtl="true"/>
77

88
</manifest>

library/src/test/java/br/com/ilhasoft/support/validation/ExampleUnitTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* To work on unit tests, switch the Test Artifact in the Build Variants view.
99
*/
1010
public class ExampleUnitTest {
11+
1112
@Test
1213
public void addition_isCorrect() throws Exception {
1314
assertEquals(4, 2 + 2);

sample/build.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ android {
44
compileSdkVersion 28
55
buildToolsVersion "28.0.3"
66

7+
// Gradle automatically adds 'android.test.runner' as a dependency.
8+
useLibrary 'android.test.runner'
9+
710
dataBinding {
811
enabled true
912
}
@@ -14,6 +17,8 @@ android {
1417
targetSdkVersion 28
1518
versionCode 1
1619
versionName "1.0"
20+
21+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1722
}
1823
buildTypes {
1924
release {
@@ -31,7 +36,13 @@ allprojects {
3136

3237
dependencies {
3338
implementation fileTree(dir: 'libs', include: ['*.jar'])
34-
testImplementation 'junit:junit:4.12'
3539
implementation project(':library')
40+
// JUnit 4 framework
41+
testImplementation 'junit:junit:4.12'
42+
// Android annotations
43+
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
44+
// AndroidJUnitRunner and JUnit Rules
45+
androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
46+
androidTestImplementation 'androidx.test:rules:1.1.0-beta02'
3647
// compile 'org.bitbucket.ilhasoft:support-validation:e3ed964'
3748
}

sample/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
android:label="@string/app_name"
99
android:supportsRtl="true"
1010
android:theme="@style/AppTheme">
11+
<uses-library android:name="android.test.runner"
12+
android:required="false" />
1113
<activity android:name=".MainActivity">
1214
<intent-filter>
1315
<action android:name="android.intent.action.MAIN" />

sample/src/test/java/br/com/ilhasoft/support/validation/ExampleUnitTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import org.junit.Test;
44

5-
import static org.junit.Assert.*;
5+
import static org.junit.Assert.assertEquals;
66

77
/**
88
* To work on unit tests, switch the Test Artifact in the Build Variants view.
99
*/
1010
public class ExampleUnitTest {
11+
1112
@Test
1213
public void addition_isCorrect() throws Exception {
1314
assertEquals(4, 2 + 2);

0 commit comments

Comments
 (0)