Trips

State

Type

Declaration

getType()

Discussion

Type of the trip

Example

val state:Trips.State
assertTrue(state.type.value == Trips.Type.SINGLE)
// Trip had a single stop

Driver name

Declaration

getDriverName()

Discussion

Name of the driver of the trip

Example

val state:Trips.State
assertTrue(state.driverName.value == "Hari Seldon")
// Driver name is 'Hari Seldon'

Description

Declaration

getDescription()

Discussion

Description of the trip

Example

val state:Trips.State
assertTrue(state.description.value == "To save humankind")
// Description of the trip is 'To save humankind'

Start time

Declaration

getStartTime()

Discussion

Start time of the trip

Example

val state:Trips.State
assertTrue(dateIsSame(state.startTime.value, "2020-06-19T12:12:10.000Z"))
// Trip started at 19 June 2020 at 12:12:10 GMT

End time

Declaration

getEndTime()

Discussion

End time of the trip

Example

val state:Trips.State
assertTrue(dateIsSame(state.endTime.value, "2020-06-19T13:12:10.000Z"))
// Trip ended at 19 June 2020 at 13:12:10 GMT

Start address

Declaration

getStartAddress()

Discussion

Start address of the trip

Example

val state:Trips.State
assertTrue(state.startAddress.value == "Skalitzer Straße 68, 10997 Berlin, Germany")
// Trip started from Skalitzer Straße 68, 10997 Berlin, Germany

End address

Declaration

getEndAddress()

Discussion

End address of the trip

Example

val state:Trips.State
assertTrue(state.endAddress.value == "Skalitzer Straße 68, 10997 Berlin, Germany")
// Trip ended at Skalitzer Straße 68, 10997 Berlin, Germany

Start coordinates

Declaration

getStartCoordinates()

Discussion

Start coordinates of the trip

Example

val state:Trips.State
assertTrue(state.startCoordinates.value?.latitude == 52.500276)
assertTrue(state.startCoordinates.value?.longitude == 13.439719)
// Trip started from 52.500276:13.439719

End coordinates

Declaration

getEndCoordinates()

Discussion

End coordinates of the trip

Example

val state:Trips.State
assertTrue(state.endCoordinates.value?.latitude == 52.500276)
assertTrue(state.endCoordinates.value?.longitude == 13.439719)
// Trip ended at 52.500276:13.439719

Start odometer

Declaration

getStartOdometer()

Discussion

Odometer reading at the start of the trip

Example

val state:Trips.State
assertTrue(state.startOdometer.value?.value == 10500.0)
assertTrue(state.startOdometer.value?.unit == Length.Unit.KILOMETERS)
// At the start of the trip the odometer was showing 10500.0km

End odometer

Declaration

getEndOdometer()

Discussion

Odometer reading at the end of the trip

Example

val state:Trips.State
assertTrue(state.endOdometer.value?.value == 10543.0)
assertTrue(state.endOdometer.value?.unit == Length.Unit.KILOMETERS)
// At the start of the trip the odometer was showing 10543.0km

Average fuel consumption

Declaration

getAverageFuelConsumption()

Discussion

Average fuel consumption during the trip

Example

val state:Trips.State
assertTrue(state.averageFuelConsumption.value?.value == 7.34)
assertTrue(state.averageFuelConsumption.value?.unit == FuelEfficiency.Unit.LITERS_PER_100_KILOMETERS)
// Average fuel consumption during the trip was 7.34 l/100km

Distance

Declaration

getDistance()

Discussion

Distance of the trip

Example

val state:Trips.State
assertTrue(state.distance.value?.value == 43.0)
assertTrue(state.distance.value?.unit == Length.Unit.KILOMETERS)
// Distance of trip was 43.0km

Start address components

Declaration

getStartAddressComponents()

Discussion

Start address components

Example

val state:Trips.State
assertTrue(state.startAddressComponents[0].value?.type == AddressComponent.Type.CITY)
assertTrue(state.startAddressComponents[0].value?.value == "Berlin")
// City component value is 'Berlin'

End address components

Declaration

getEndAddressComponents()

Discussion

End address components

Example

val state:Trips.State
assertTrue(state.endAddressComponents[0].value?.type == AddressComponent.Type.CITY)
assertTrue(state.endAddressComponents[0].value?.value == "Berlin")
// City component value is 'Berlin'