From 69818a3ba9a542dc4da84e919a26ad8f82691aec Mon Sep 17 00:00:00 2001 From: Oleksandr Kruk Date: Sun, 12 Jan 2025 22:43:51 +0000 Subject: [PATCH] Upgrade dependencies --- .github/workflows/main.yml | 11 +- .idea/appInsightsSettings.xml | 23 ++ .idea/caches/deviceStreaming.xml | 340 ++++++++++++++++++ .idea/kotlinc.xml | 12 +- .idea/migrations.xml | 10 + .idea/misc.xml | 3 +- .idea/runConfigurations.xml | 17 + .idea/studiobot.xml | 6 + CHANGELOG.md | 11 + gradle.properties | 2 + gradle/wrapper/gradle-wrapper.properties | 3 +- worldtides/build.gradle.kts | 12 +- .../extremes/WorldTidesGatewayTest.kt | 37 +- .../extremes/WorldTidesRepositoryTest.kt | 6 +- 14 files changed, 457 insertions(+), 36 deletions(-) create mode 100644 .idea/appInsightsSettings.xml create mode 100644 .idea/caches/deviceStreaming.xml create mode 100644 .idea/migrations.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 .idea/studiobot.xml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b418c4f..79c2ca9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,12 +13,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: gradle/wrapper-validation-action@v1 + - uses: actions/checkout@v4 + - uses: gradle/actions/wrapper-validation@v4 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Setup Java + uses: actions/setup-java@v4 with: - java-version: 1.8 + distribution: 'jetbrains' + java-version: '21' - name: Build and Unit Test run: ./gradlew build diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml new file mode 100644 index 0000000..ea8573a --- /dev/null +++ b/.idea/appInsightsSettings.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml new file mode 100644 index 0000000..406736c --- /dev/null +++ b/.idea/caches/deviceStreaming.xml @@ -0,0 +1,340 @@ + + + + + + \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 7e340a7..2581d7b 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,16 @@ + + + + + + - \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 39a3deb..7c80856 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -43,7 +44,7 @@ - + diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/.idea/studiobot.xml b/.idea/studiobot.xml new file mode 100644 index 0000000..539e3b8 --- /dev/null +++ b/.idea/studiobot.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 495d331..bf42450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## UNRELEASED + +### Changed + +- Bump Kotlin version to 1.9.20 +- Bump Gradle to 8.9 +- Bump mockito to 5.13.0 +- Bump to JDK_1_8 +- Replace jcenter() with mavenCentral() +- Update github actions setup + ## 1.0.0 - 2021-02-15 ### Added diff --git a/gradle.properties b/gradle.properties index f5a4574..07d637c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,3 +14,5 @@ POM_DEV_EMAIL=kruk.oleksandr@gmail.com POM_SCM_URL=https://github.com/0mega/worldtides/ POM_SCM_CONNECTION=scm:git@github.com:0mega/worldtides.git POM_SCM_DEV_CONNECTION=scm:git@github.com:0mega/worldtides.git + +org.gradle.warning.mode=all \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a2..5ba1656 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Sun Jan 12 21:38:08 GMT 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/worldtides/build.gradle.kts b/worldtides/build.gradle.kts index 91aebda..533e57e 100644 --- a/worldtides/build.gradle.kts +++ b/worldtides/build.gradle.kts @@ -1,7 +1,7 @@ plugins { // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. - id("org.jetbrains.kotlin.jvm") version "1.4.10" + id("org.jetbrains.kotlin.jvm") version "1.9.20" // Apply the java-library plugin for API and implementation separation. `java-library` @@ -14,8 +14,8 @@ plugins { } repositories { - // Use JCenter for resolving dependencies. - jcenter() + // Use Maven central for resolving dependencies. + mavenCentral() } dependencies { @@ -34,14 +34,12 @@ dependencies { implementation("com.squareup.moshi:moshi-kotlin:1.11.0") // Use the Kotlin test library. - testImplementation("org.jetbrains.kotlin:kotlin-test") - // Use the Kotlin JUnit integration. - testImplementation("org.jetbrains.kotlin:kotlin-test-junit") + testImplementation(kotlin("test")) testImplementation("org.assertj:assertj-core:3.12.2") testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2") testImplementation("com.squareup.okhttp3:mockwebserver:3.12.0") - testImplementation("org.mockito:mockito-core:3.3.1") + testImplementation("org.mockito:mockito-core:5.13.0") } group = project.property("GROUP") as String diff --git a/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesGatewayTest.kt b/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesGatewayTest.kt index 68c91af..b1e3664 100644 --- a/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesGatewayTest.kt +++ b/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesGatewayTest.kt @@ -3,8 +3,9 @@ package com.oleksandrkruk.worldtides.extremes import com.oleksandrkruk.worldtides.RetrofitClient import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer -import org.junit.Assert import org.junit.jupiter.api.AfterEach +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -58,61 +59,61 @@ class WorldTidesGatewayTest { fun containsExtremesInQueryParams() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("extremes")) + assertTrue(requestUrl!!.queryParameterNames().contains("extremes")) } @Test fun containsDateInQueryParams() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("date")) - Assert.assertEquals("foo", requestUrl.queryParameter("date")) + assertTrue(requestUrl!!.queryParameterNames().contains("date")) + assertEquals("foo", requestUrl.queryParameter("date")) } @Test fun containsDaysInQueryParams() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("days")) - Assert.assertEquals("1", requestUrl.queryParameter("days")) + assertTrue(requestUrl!!.queryParameterNames().contains("days")) + assertEquals("1", requestUrl.queryParameter("days")) } @Test fun containsLatInQueryParams() { val response = service?.extremes("foo", 1, "25.134", "baz", "key")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("lat")) - Assert.assertEquals("25.134", requestUrl.queryParameter("lat")) + assertTrue(requestUrl!!.queryParameterNames().contains("lat")) + assertEquals("25.134", requestUrl.queryParameter("lat")) } @Test fun containsLonInQueryParams() { val response = service?.extremes("foo", 1, "bar", "13.948", "key")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("lon")) - Assert.assertEquals("13.948", requestUrl.queryParameter("lon")) + assertTrue(requestUrl!!.queryParameterNames().contains("lon")) + assertEquals("13.948", requestUrl.queryParameter("lon")) } @Test fun containsApiKeyInQueryParams() { val response = service?.extremes("foo", 1, "bar", "baz", "someKey")?.execute() val requestUrl = response?.raw()?.request()?.url() - Assert.assertTrue(requestUrl!!.queryParameterNames().contains("key")) - Assert.assertEquals("someKey", requestUrl.queryParameter("key")) + assertTrue(requestUrl!!.queryParameterNames().contains("key")) + assertEquals("someKey", requestUrl.queryParameter("key")) } @Test fun parsesThreeTideExtremesFromMockJsonResponse() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() - Assert.assertTrue(response!!.isSuccessful) - Assert.assertEquals(3, response.body()?.extremes?.size) + assertTrue(response!!.isSuccessful) + assertEquals(3, response.body()?.extremes?.size) } @Test fun parsesTideExtremeTypesFromMockJsonResponse() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() - Assert.assertTrue(response!!.isSuccessful) - Assert.assertEquals( + assertTrue(response!!.isSuccessful) + assertEquals( listOf("High", "Low", "High"), response.body()?.extremes?.map { extreme -> extreme.type }) } @@ -120,8 +121,8 @@ class WorldTidesGatewayTest { @Test fun parsesTideExtremeDatesFromMockJsonResponse() { val response = service?.extremes("foo", 1, "bar", "baz", "key")?.execute() - Assert.assertTrue(response!!.isSuccessful) - Assert.assertEquals(listOf( + assertTrue(response!!.isSuccessful) + assertEquals(listOf( "2021-02-17T05:37+0000", "2021-02-17T11:49+0000", "2021-02-17T17:58+0000"), diff --git a/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesRepositoryTest.kt b/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesRepositoryTest.kt index e11a58c..a4eb158 100644 --- a/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesRepositoryTest.kt +++ b/worldtides/src/test/kotlin/com/oleksandrkruk/worldtides/extremes/WorldTidesRepositoryTest.kt @@ -5,7 +5,8 @@ import com.oleksandrkruk.worldtides.extremes.data.TideExtremesResponse import com.oleksandrkruk.worldtides.extremes.models.TideType import okhttp3.MediaType import okhttp3.ResponseBody -import org.junit.Assert.assertEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.ArgumentMatchers @@ -20,7 +21,6 @@ import retrofit2.Callback import retrofit2.Response import java.text.SimpleDateFormat import java.util.* -import kotlin.test.assertTrue import kotlin.test.fail @Suppress("UNCHECKED_CAST") @@ -40,7 +40,7 @@ class WorldTidesRepositoryTest { @BeforeEach fun setup() { - MockitoAnnotations.initMocks(this) + MockitoAnnotations.openMocks(this) `when`(dateFormatterMock.parse(ArgumentMatchers.any())).thenReturn(today) tidesRepository = WorldTidesRepository(gatewayMock, dateFormatterMock)