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
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ data class TrackSectionDto(
// val trackSectionStart: TrackSectionStopPlaceRef?,
// val trackSectionEnd: TrackSectionStopPlaceRef?,
@Element(name = "LinkProjection")
val linkProjection: LinearShapeDto,
val linkProjection: LinearShapeDto?
) : Parcelable
22 changes: 22 additions & 0 deletions sdk/src/test/java/ch/opentransportdata/ojp/OjpSdkTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import assertk.assertions.isInstanceOf
import assertk.assertions.isNotEmpty
import assertk.assertions.isNotNull
import ch.opentransportdata.ojp.data.dto.OjpDto
import ch.opentransportdata.ojp.data.dto.converter.DurationTypeConverter
import ch.opentransportdata.ojp.data.dto.converter.LocalDateTimeTypeConverter
import ch.opentransportdata.ojp.data.dto.converter.PtModeTypeConverter
import ch.opentransportdata.ojp.data.dto.converter.TransferTypeConverter
import ch.opentransportdata.ojp.domain.model.*
import ch.opentransportdata.ojp.domain.model.error.OjpError
import ch.opentransportdata.ojp.domain.usecase.Initializer
Expand All @@ -16,6 +18,7 @@ import kotlinx.coroutines.test.runTest
import org.junit.Assert.assertThrows
import org.junit.Before
import org.junit.Test
import java.time.Duration
import java.time.ZoneId


Expand Down Expand Up @@ -96,6 +99,25 @@ internal class OjpSdkTest {
assertThat(result).isNotNull()
}

@Test
fun `Another valid XML data should allow successful parsing to an OjpDto`() {
// GIVEN
val xmlFile = "src/test/resources/response_valid_2.xml"
val bufferedSource = TestUtils().readXmlFile(xmlFile)
val tikXml = TikXml.Builder()
.addTypeConverter(java.time.LocalDateTime::class.java, LocalDateTimeTypeConverter(initializer))
.addTypeConverter(Duration::class.java, DurationTypeConverter())
.addTypeConverter(PtMode::class.java, PtModeTypeConverter())
.addTypeConverter(TransferType::class.java, TransferTypeConverter())
.build()

// ACTION
val result = tikXml.read<OjpDto>(bufferedSource, OjpDto::class.java)

// ASSERTION
assertThat(result).isNotNull()
}

@Test
fun `requestLocationsFromSearchTerm with valid data should return a list of places`() {
runTest {
Expand Down
Loading
Loading