Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,30 @@ jobs:
path: ${{ runner.temp }}/ci-report-unit-tests
if-no-files-found: ignore


test-modern-jdks:
name: SDK tests on Java ${{ matrix.test-java }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-java: [11, 17, 19, 21, 25, 27]

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up JDK 11, 17, 19, 21, 25 and 27
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
java-version: |
11
21
19
25
27
17
distribution: 'corretto'

- name: Run SDK tests
run: ./gradlew :sdk-java:test -PtestJavaVersion=${{ matrix.test-java }} -Porg.gradle.java.installations.fromEnv=JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_19_X64,JAVA_HOME_21_X64,JAVA_HOME_25_X64,JAVA_HOME_27_X64
2 changes: 1 addition & 1 deletion sdk-java-ui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
implementation 'org.json:json:20260814'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'org.mockito:mockito-core:5.25.0'
}

// -PtestUiWithLocalCore=true builds and tests this module's source against the sdk-java project
Expand Down
7 changes: 4 additions & 3 deletions sdk-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ if (JavaVersion.current().isJava9Compatible()) {
}

// Gradle itself needs Java 17, so CI passes -PtestJavaVersion=8 to run the tests on the SDK's Java 8 floor.
def testJavaVersion = findProperty('testJavaVersion')
if (testJavaVersion) {
def testJavaVersion = findProperty('testJavaVersion') ?: JavaVersion.current().majorVersion
def mockitoVersion = testJavaVersion.toString().toInteger() >= 11 ? '5.25.0' : '4.11.0'
if (findProperty('testJavaVersion')) {
tasks.named('test') {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(testJavaVersion.toString())
Expand All @@ -32,7 +33,7 @@ dependencies {
implementation 'com.google.code.findbugs:jsr305:3.0.2'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
//testImplementation 'com.squareup.okhttp3:mockwebserver:3.7.0'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public void setupMigrations_latestVersion() throws IOException {
initStorage(); // to initialize json storage after data version is set to expectedLatestVersion

MigrationHelper migrationHelper = new MigrationHelper(mock(Log.class));
migrationHelper.logger = spy(migrationHelper.logger);
migrationHelper.setupMigrations(storageProvider);
Assert.assertEquals(expectedLatestSchemaVersion, migrationHelper.currentDataModelVersion);

Expand Down Expand Up @@ -199,7 +198,6 @@ public void applyMigrations_0to1() throws IOException {
migrationHelper.setupMigrations(storageProvider);
Assert.assertEquals(0, migrationHelper.currentDataModelVersion); //legacy state

migrationHelper.logger = Mockito.spy(migrationHelper.logger);
//run migration helper
Assert.assertNull(storageProvider.getDeviceID());
Assert.assertNull(storageProvider.getDeviceIdType());
Expand Down Expand Up @@ -297,7 +295,6 @@ public void applyMigrations_1to2_nothingToMigrate() throws IOException {
MigrationHelper migrationHelper = new MigrationHelper(mock(Log.class));
migrationHelper.setupMigrations(storageProvider);
Assert.assertEquals(1, migrationHelper.currentDataModelVersion);
migrationHelper.logger = Mockito.spy(migrationHelper.logger);

migrationHelper.migration_UserImplFile_02(migrationParams);
Assert.assertEquals(2, migrationHelper.currentDataModelVersion);
Expand All @@ -317,7 +314,6 @@ public void applyMigrations_1to2_nullMigrationParams() throws IOException {
MigrationHelper migrationHelper = new MigrationHelper(mock(Log.class));
migrationHelper.setupMigrations(storageProvider);
Assert.assertEquals(1, migrationHelper.currentDataModelVersion);
migrationHelper.logger = Mockito.spy(migrationHelper.logger);

Assert.assertFalse(migrationHelper.migration_UserImplFile_02(new ConcurrentHashMap<>()));
Assert.assertEquals(2, migrationHelper.currentDataModelVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public void cacheClearValues_cachingEnabled() {
@Test
public void cacheClearValues_garbageJson() {
RemoteConfigValueStore rcvs = new RemoteConfigValueStore(garbageJson(), true, Mockito.mock(Log.class));
rcvs.L = Mockito.spy(rcvs.L);
rcvs.cacheClearValues();
Mockito.verify(rcvs.L, Mockito.times(1)).w("[RemoteConfigValueStore] cacheClearValues, stored entry was not a JSON object, key:[" + TestUtils.keysValues[0] + "] value:[garbage]");
Assert.assertEquals(0, rcvs.getAllValues().size());
Expand Down Expand Up @@ -145,7 +144,6 @@ public void mergeValues_nullRcValues() {
@Test
public void getValue_nullRcValues() {
RemoteConfigValueStore rcvs = new RemoteConfigValueStore(null, true, Mockito.mock(Log.class));
rcvs.L = Mockito.spy(rcvs.L);
Assert.assertNull(rcvs.getValue(TestUtils.keysValues[0]).value);
Mockito.verify(rcvs.L, Mockito.times(1)).e(Mockito.anyString());
}
Expand Down Expand Up @@ -227,7 +225,6 @@ public void getAllValues_garbageJson() {
@Test
public void getAllValues_garbageCacheKey() {
RemoteConfigValueStore rcvs = new RemoteConfigValueStore(rcvsJson("garbage"), true, Mockito.mock(Log.class));
rcvs.L = Mockito.spy(rcvs.L);
Assert.assertEquals(0, rcvs.getAllValues().size());
Mockito.verify(rcvs.L, Mockito.times(2)).e(Mockito.anyString());
Assert.assertEquals(2, rcvs.values.length());
Expand Down
Loading