Skip to content

Commit

Permalink
Fix test build
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Oct 23, 2024
1 parent fb5da2a commit 68d494d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,15 +35,15 @@ 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) {
throw IllegalStateException(e)
}
}

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 68d494d

Please sign in to comment.