Skip to content

Commit 5ddd9c4

Browse files
DTPOMERSER-1415 Update Project to Gradle 7 (#150)
* Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update ci.yml * Update to gradle 7 * Bumpup jacoco version * Bumpup jacoco version * Bumpup jacoco version * Update mockito-core from 3.2.0 to 5.15.2 * Update appcompat from 1.2.0 to 1.7.0 * Fix the artifact naming logic * Update robolectric and hamcrest * Update robolectric and hamcrest
1 parent 963adda commit 5ddd9c4

File tree

10 files changed

+48
-21
lines changed

10 files changed

+48
-21
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
java-version: [ 11 ]
22+
java-version: [ 17 ]
2323

2424
steps:
2525
- uses: actions/checkout@v4
2626

2727
- name: Setup JDK ${{ matrix.java }}
2828
uses: actions/setup-java@v4
2929
with:
30-
distribution: 'zulu'
30+
distribution: 'temurin'
3131
java-version: ${{ matrix.java-version }}
3232

3333
- name: Setup Android SDK
34-
uses: android-actions/setup-android@v2
34+
uses: android-actions/setup-android@v3
3535

3636
- name: Build CORE SDK ${{ matrix.java-version }}
3737
run: ./gradlew --scan clean lint testDebugUnitTest jacocoTestCoverageVerification

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
mavenLocal()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.6.4'
9+
classpath 'com.android.tools.build:gradle:7.4.2'
1010
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7"
1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -19,7 +19,7 @@ allprojects {
1919
mavenCentral()
2020
mavenLocal()
2121
}
22-
project.version = "1.0.2"
22+
project.version = "1.0.3-beta-1"
2323
}
2424

2525
task clean(type: Delete) {

core/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ android {
1111
minSdkVersion 21
1212
targetSdkVersion 34
1313
versionCode 4
14-
versionName version
1514
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15+
buildConfigField("String", "VERSION_NAME", "\"$version\"")
1616
}
1717

1818
buildTypes {
@@ -24,7 +24,7 @@ android {
2424
// Rename the artifact to core-<version>.aar, required since gradle 7
2525
libraryVariants.all { variant ->
2626
variant.outputs.all { output ->
27-
outputFileName = "${archivesBaseName}-${defaultConfig.versionName}.aar"
27+
outputFileName = "${archivesBaseName}-${version}.aar"
2828
}
2929
}
3030
}
@@ -43,16 +43,16 @@ android {
4343

4444
dependencies {
4545

46-
implementation "androidx.appcompat:appcompat:1.2.0"
47-
implementation "androidx.annotation:annotation:1.8.2"
46+
implementation 'androidx.appcompat:appcompat:1.7.0'
47+
implementation 'androidx.annotation:annotation:1.9.1'
4848

4949
testImplementation 'junit:junit:4.13.2'
50-
testImplementation 'org.robolectric:robolectric:4.12.2'
51-
testImplementation "org.mockito:mockito-core:3.2.0"
50+
testImplementation 'org.robolectric:robolectric:4.14.1'
51+
testImplementation 'org.mockito:mockito-core:5.15.2'
5252
testImplementation "com.squareup.okhttp3:mockwebserver:4.12.0"
5353
testImplementation group: 'pl.pragmatists', name: 'JUnitParams', version: "1.1.1"
54-
testImplementation 'org.hamcrest:hamcrest:2.1'
55-
testImplementation 'org.hamcrest:hamcrest-library:2.1'
54+
testImplementation 'org.hamcrest:hamcrest:3.0'
55+
testImplementation 'org.hamcrest:hamcrest-library:3.0'
5656
}
5757

5858

core/config/jacoco-settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'jacoco'
22

3-
final def jacocoVersion = "0.8.2"
3+
final def jacocoVersion = "0.8.8"
44

55
jacoco {
66
toolVersion = jacocoVersion

core/src/test/java/com/hyperwallet/android/ConfigurationTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@
66
import static org.hamcrest.Matchers.notNullValue;
77
import static org.junit.Assert.fail;
88

9+
import com.hyperwallet.android.util.MockShadowSystemClock;
10+
911
import org.json.JSONException;
1012
import org.junit.BeforeClass;
1113
import org.junit.Rule;
1214
import org.junit.Test;
1315
import org.junit.rules.ExpectedException;
1416
import org.junit.runner.RunWith;
1517
import org.robolectric.RobolectricTestRunner;
18+
import org.robolectric.annotation.Config;
1619

1720
import java.util.Date;
1821

1922
@RunWith(RobolectricTestRunner.class)
23+
@Config(shadows = { MockShadowSystemClock.class})
2024
public class ConfigurationTest {
2125

2226
private static Configuration mConfiguration;

core/src/test/java/com/hyperwallet/android/RestTransactionBuilderTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void testBuild_withRequiredParametersOnly() throws JSONException {
6767
assertThat(headers.get("Content-Type"), is("application/json"));
6868
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
6969
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
70-
assertThat(headers.get("X-Sdk-Version"), is("1.0.2"));
70+
assertThat(headers.get("X-Sdk-Version"), is("1.0.3-beta-1"));
7171
assertThat(headers.get("X-Sdk-Type"), is("android"));
7272
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
7373
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
@@ -104,7 +104,7 @@ public void testBuild_withJsonModelOptionalParameter() throws JSONException {
104104
assertThat(headers.get("Content-Type"), is("application/json"));
105105
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
106106
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
107-
assertThat(headers.get("X-Sdk-Version"), is("1.0.2"));
107+
assertThat(headers.get("X-Sdk-Version"), is("1.0.3-beta-1"));
108108
assertThat(headers.get("X-Sdk-Type"), is("android"));
109109
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
110110
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));
@@ -140,7 +140,7 @@ public void testBuild_withQueryModelOptionalParameter() throws JSONException {
140140
assertThat(headers.get("Content-Type"), is("application/json"));
141141
assertThat(headers.get("User-Agent"), is("HyperwalletSDK/Android/" + BuildConfig.VERSION_NAME +
142142
"; App: HyperwalletSDK; Android: " + Build.VERSION.RELEASE));
143-
assertThat(headers.get("X-Sdk-Version"), is("1.0.2"));
143+
assertThat(headers.get("X-Sdk-Version"), is("1.0.3-beta-1"));
144144
assertThat(headers.get("X-Sdk-Type"), is("android"));
145145
assertThat(headers.get("X-Sdk-ContextId"), is(notNullValue()));
146146
assertThat(headers.get("X-Sdk-ContextId"), is(contextId));

core/src/test/java/com/hyperwallet/android/balance/ListBalancesTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.hyperwallet.android.Hyperwallet;
2323
import com.hyperwallet.android.exception.HyperwalletException;
24-
import com.hyperwallet.android.exception.HyperwalletRestException;
2524
import com.hyperwallet.android.listener.HyperwalletListener;
2625
import com.hyperwallet.android.model.Error;
2726
import com.hyperwallet.android.model.Errors;
@@ -32,6 +31,7 @@
3231
import com.hyperwallet.android.rule.HyperwalletMockWebServer;
3332
import com.hyperwallet.android.rule.HyperwalletSdkMock;
3433
import com.hyperwallet.android.sdk.R;
34+
import com.hyperwallet.android.util.MockShadowSystemClock;
3535

3636
import org.junit.Rule;
3737
import org.junit.Test;
@@ -42,13 +42,15 @@
4242
import org.mockito.junit.MockitoJUnit;
4343
import org.mockito.junit.MockitoRule;
4444
import org.robolectric.RobolectricTestRunner;
45+
import org.robolectric.annotation.Config;
4546

4647
import java.util.concurrent.CountDownLatch;
4748
import java.util.concurrent.TimeUnit;
4849

4950
import okhttp3.mockwebserver.RecordedRequest;
5051

5152
@RunWith(RobolectricTestRunner.class)
53+
@Config(shadows = { MockShadowSystemClock.class})
5254
public class ListBalancesTest {
5355
@Rule
5456
public ExternalResourceManager mExternalResourceManager = new ExternalResourceManager();

core/src/test/java/com/hyperwallet/android/transfermethod/DeactivateBankCardTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import static org.hamcrest.Matchers.endsWith;
55
import static org.hamcrest.Matchers.is;
66
import static org.junit.Assert.assertNotNull;
7-
import static org.mockito.Matchers.any;
7+
import static org.mockito.ArgumentMatchers.any;
88
import static org.mockito.Mockito.never;
99
import static org.mockito.Mockito.verify;
1010

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.hyperwallet.android.util;
2+
3+
import android.os.SystemClock;
4+
5+
import org.robolectric.annotation.Implements;
6+
7+
/**
8+
* Simple SystemClock Shadow representation
9+
* <p>
10+
* Since Gradle 7, the Shadows SystemClock no longer supported
11+
* by Android Shadow provided by Robolectric
12+
*/
13+
@Implements(value = SystemClock.class, callThroughByDefault = true)
14+
public final class MockShadowSystemClock {
15+
private MockShadowSystemClock() {
16+
}
17+
18+
public static long elapsedRealtime() {
19+
return 0;
20+
}
21+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Jun 04 07:20:15 PDT 2024
1+
#Tue Feb 18 18:24:15 EST 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)