From 68d494dfc76dc55643fbb63427c9c734afee7d39 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 23 Oct 2024 12:04:10 +0100 Subject: [PATCH] Fix test build --- .../kotlin/de/cyface/synchronization/MockedUploader.kt | 5 +++-- .../kotlin/de/cyface/synchronization/SyncPerformerTest.kt | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/synchronization/src/androidTest/kotlin/de/cyface/synchronization/MockedUploader.kt b/synchronization/src/androidTest/kotlin/de/cyface/synchronization/MockedUploader.kt index 5abcca4e..63d241dd 100644 --- a/synchronization/src/androidTest/kotlin/de/cyface/synchronization/MockedUploader.kt +++ b/synchronization/src/androidTest/kotlin/de/cyface/synchronization/MockedUploader.kt @@ -23,6 +23,7 @@ import de.cyface.uploader.UploadProgressListener import de.cyface.uploader.Uploader import de.cyface.uploader.model.Attachment import de.cyface.uploader.model.Measurement +import de.cyface.uploader.model.Uploadable import java.io.File import java.net.MalformedURLException import java.net.URL @@ -34,7 +35,7 @@ import java.net.URL */ internal class MockedUploader : Uploader { - override fun measurementsEndpoint(): URL { + override fun measurementsEndpoint(uploadable: Uploadable): URL { return try { URL("https://mocked.cyface.de/api/v123/measurements") } catch (e: MalformedURLException) { @@ -42,7 +43,7 @@ internal class MockedUploader : Uploader { } } - override fun attachmentsEndpoint(deviceId: String, measurementId: Long): URL { + override fun attachmentsEndpoint(uploadable: Uploadable): URL { return try { URL("https://mocked.cyface.de/api/v123/measurements/did/mid/attachments") } catch (e: MalformedURLException) { diff --git a/synchronization/src/androidTest/kotlin/de/cyface/synchronization/SyncPerformerTest.kt b/synchronization/src/androidTest/kotlin/de/cyface/synchronization/SyncPerformerTest.kt index 1b62eba8..60ae1dee 100644 --- a/synchronization/src/androidTest/kotlin/de/cyface/synchronization/SyncPerformerTest.kt +++ b/synchronization/src/androidTest/kotlin/de/cyface/synchronization/SyncPerformerTest.kt @@ -57,6 +57,7 @@ import de.cyface.uploader.exception.UploadFailed import de.cyface.uploader.exception.UploadSessionExpired import de.cyface.uploader.model.Attachment import de.cyface.uploader.model.MeasurementIdentifier +import de.cyface.uploader.model.Uploadable import de.cyface.uploader.model.metadata.ApplicationMetaData import de.cyface.uploader.model.metadata.AttachmentMetaData import de.cyface.uploader.model.metadata.DeviceMetaData @@ -309,12 +310,12 @@ class SyncPerformerTest { // Mock the actual post request val mockedUploader = object : Uploader { - override fun measurementsEndpoint(): URL { + override fun measurementsEndpoint(uploadable: Uploadable): URL { return URL("https://mocked.cyface.de/api/v123/measurements") } - override fun attachmentsEndpoint(deviceId: String, measurementId: Long): URL { - return URL("https://mocked.cyface.de/api/v123/measurements/$deviceId/$measurementId/attachments") + override fun attachmentsEndpoint(uploadable: Uploadable): URL { + return URL("https://mocked.cyface.de/api/v123/measurements/${uploadable.deviceId()}/${uploadable.measurementId()}/attachments") } override fun uploadMeasurement(