How to use test method of io.kotest.matchers.date.localtime class

Best Kotest code snippet using io.kotest.matchers.date.localtime.test

BookingServiceTest.kt

Source:BookingServiceTest.kt Github

copy

Full Screen

1// SPDX-FileCopyrightText: 2020, 2022 Lars Geyer-Blaumeiser <lars@lgblaumeiser.de>2// SPDX-License-Identifier: MIT3package de.lgblaumeiser.ptm.service4import io.kotest.assertions.throwables.shouldThrow5import io.kotest.core.spec.style.WordSpec6import io.kotest.matchers.collections.shouldBeEmpty7import io.kotest.matchers.collections.shouldContainExactly8import io.kotest.matchers.should9import java.time.LocalDate10import java.time.LocalTime11class BookingServiceTest : WordSpec({12 beforeTest {13 initializeBookingService()14 }15 "getBookings" should {16 "return an empty collection when nothing is stored" {17 should { bookingService.getBookings(testBookingUser1).shouldBeEmpty() }18 }19 }20 "getBooking with time frame" should {21 "return an empty collection when nothing is stored (only starttime)" {22 should { bookingService.getBookings(testBookingUser1, testDate1) }23 }24 "return an empty collection when nothing is stored (starttime and enttime)" {25 should { bookingService.getBookings(testBookingUser1, testDate1, testDate2) }26 }27 "return with exception if timeframe is defined negative" {28 shouldThrow<IllegalArgumentException> { bookingService.getBookings(testBookingUser1, testDate2, testDate1) }29 }30 }31 "getBookingById" should {32 "return an exception if asked for a id that do not exist" {33 shouldThrow<IllegalArgumentException> { bookingService.getBookingById(testBookingUser1, 1L) }34 }35 }36 "add booking" should {37 "minimal add booking stores the defined booking" {38 val booking = addMinimalBooking()39 should {40 bookingService.getBookings(testBookingUser1).shouldContainExactly(testBooking1.copy( id = booking.id ))41 bookingService.getBookings(testBookingUser2).shouldBeEmpty()42 bookingService.getBookings(testBookingUser1, testDate1).shouldContainExactly(booking)43 bookingService.getBookings(testBookingUser1, testDate1, testDate2).shouldContainExactly(booking)44 bookingService.getBookings(testBookingUser1, testDate2)45 bookingService.getBookingById(testBookingUser1, 1L) == booking46 shouldThrow<IllegalAccessException> { bookingService.getBookingById(testBookingUser2, 1L) }47 shouldThrow<IllegalArgumentException> { bookingService.getBookingById(testBookingUser1, 2L) }48 }49 }50 "maximal add booking stores the defined booking" {51 val booking = addCompleteBooking()52 should {53 bookingService.getBookings(testBookingUser1).shouldContainExactly(testBooking2.copy( id = booking.id ))54 val retrieved = bookingService.getBookingById(testBookingUser1, 1L)55 retrieved == testBooking2.copy( id = booking.id )56 }57 }58 "an open booking is closed when new booking arrives" {59 val booking1 = addMinimalBooking()60 val booking2 = addCompleteBooking()61 should {62 bookingService.getBookingById(testBookingUser1, 1L) == testBooking1.copy( id = booking1.id, endtime = LocalTime.parse(testTime2) )63 bookingService.getBookingById(testBookingUser1, 2L) == testBooking2.copy( id = booking2.id )64 bookingService.getBookings(testBookingUser1, testDate1)[1] == booking265 }66 }67 "two bookings stored by different users can only be retrieved by corresponding user" {68 val booking1 = addMinimalBooking()69 val booking2 =70 bookingService.addBooking(testBookingUser2, testDate1, testTime2, testTime3, testActivityId2, testComment)71 should {72 bookingService.getBookings(testBookingUser1).shouldContainExactly(booking1)73 bookingService.getBookings(testBookingUser2).shouldContainExactly(booking2)74 }75 }76 }77 "change booking" should {78 "changing an existing booking result in a data object with the changed values" {79 val booking = addMinimalBooking()80 bookingService.changeBooking(81 user = testBookingUser1,82 bookingday = testDate2,83 endtime = testTime4,84 comment = testComment,85 id = booking.id86 )87 val changed = bookingService.getBookingById(testBookingUser1, booking.id)88 should {89 changed.user == testBookingUser190 changed.activity == testActivityId191 changed.bookingday == LocalDate.parse(testDate2)92 changed.starttime == LocalTime.parse(testTime1)93 changed.endtime == LocalTime.parse(testTime4)94 changed.comment == testComment95 }96 }97 "changing an existing booking not possible for different user" {98 val booking = addMinimalBooking()99 shouldThrow<IllegalAccessException> {100 bookingService.changeBooking(101 user = testBookingUser2,102 bookingday = testDate2,103 endtime = testTime4,104 comment = testComment,105 id = booking.id106 )107 }108 }109 }110 "split booking" should {111 "should create a proper second booking if parameters are right" {112 val booking = addLongBooking()113 val (first, second) = bookingService.splitBooking(testBookingUser1, testTime2, testDuration, booking.id)114 should {115 first.user == testBookingUser1116 second.user == testBookingUser1117 first.bookingday == LocalDate.parse(testDate1)118 second.bookingday == LocalDate.parse(testDate1)119 first.starttime == LocalTime.parse(testTime1)120 first.endtime == LocalTime.parse(testTime2)121 second.starttime == LocalTime.parse(testTime2).plusMinutes(testDuration)122 second.endtime == LocalTime.parse(testTime4)123 first.activity == testActivityId1124 second.activity == testActivityId2125 first.comment == testComment126 second.comment == testComment127 }128 }129 "should create a proper second booking if parameters are right with default duration" {130 val booking = addLongBooking()131 val (first, second) = bookingService.splitBooking(user = testBookingUser1, starttime = testTime2, id = booking.id)132 should {133 first.user == testBookingUser1134 second.user == testBookingUser1135 first.bookingday == LocalDate.parse(testDate1)136 second.bookingday == LocalDate.parse(testDate1)137 first.starttime == LocalTime.parse(testTime1)138 first.endtime == LocalTime.parse(testTime2)139 second.starttime == LocalTime.parse(testTime2).plusMinutes(30L)140 second.endtime == LocalTime.parse(testTime4)141 first.activity == testActivityId1142 second.activity == testActivityId2143 first.comment == testComment144 second.comment == testComment145 }146 }147 "throws exception if wrong user is given" {148 val booking = addLongBooking()149 shouldThrow<IllegalAccessException> {150 bookingService.splitBooking(151 testBookingUser2,152 testTime2,153 testDuration,154 booking.id155 )156 }157 }158 "throws exception if split time is not in time frame" {159 val booking = addCompleteBooking()160 shouldThrow<IllegalArgumentException> {161 bookingService.splitBooking(162 testBookingUser1,163 testTime1,164 testDuration,165 booking.id166 )167 }168 }169 "throws exception if duration is longer then endtime" {170 val booking =171 bookingService.addBooking(testBookingUser1, testDate1, testTime1, testTime3, testActivityId1, testComment)172 shouldThrow<IllegalArgumentException> {173 bookingService.splitBooking(174 testBookingUser1,175 testTime2,176 testDuration,177 booking.id178 )179 }180 }181 }182 "delete booking" should {183 "removes booking if properties match" {184 val booking = addLongBooking()185 should { bookingService.getBookingById(testBookingUser1, 1L) == booking }186 bookingService.deleteBooking(testBookingUser1, booking.id)187 shouldThrow<IllegalArgumentException> { bookingService.getBookingById(testBookingUser1, booking.id) }188 }189 "throws access exception if booking is deleted by wrong user" {190 val booking = addLongBooking()191 should { bookingService.getBookingById(testBookingUser1, 1L) == booking }192 shouldThrow<IllegalAccessException> {193 bookingService.deleteBooking(testBookingUser2, booking.id)194 }195 }196 }197})...

Full Screen

Full Screen

DslTest.kt

Source:DslTest.kt Github

copy

Full Screen

...18import com.github.cpickl.timesheet.someWorkingDay19import com.github.cpickl.timesheet.tag120import com.github.cpickl.timesheet.tag221import com.github.cpickl.timesheet.timesheet22import io.kotest.core.spec.style.DescribeSpec23import io.kotest.matchers.collections.shouldContain24import io.kotest.matchers.collections.shouldContainExactly25import io.kotest.matchers.collections.shouldHaveSize26import io.kotest.matchers.shouldBe27import io.kotest.matchers.string.shouldContain28import io.kotest.matchers.types.shouldBeInstanceOf29import java.time.LocalDate30import java.time.LocalTime31import java.time.Month32class BuilderTest : DescribeSpec({33 val someDate = TestConstants.someDate34 val date1 = TestConstants.date135 val date2 = TestConstants.date236 val someTimeRange = TestConstants.someTimeRange37 val someTimeRangeString = someTimeRange.toParseableString()38 val anyTimeRangeString = someTimeRange.toParseableString()39 val timeRange1 = TestConstants.timeRange140 val timeRange2 = TestConstants.timeRange241 val description = "test description"42 val anyDescription = "any description"43 val anyYear = 201044 val anyMonth = Month.JULY45 val someTag = Tag.any46 val tag1 = Tag.tag147 val tag2 = Tag.tag248 val someOffReason = OffReason.any49 describe("When sunshine case") {50 it("valid working day and entry Then sheet's start date is of work entry") {51 val sheet = timesheet {52 someWorkingDay(someDate) {53 someWorkEntry()54 }55 }56 sheet.startDate shouldBe someDate57 }58 it("two valid working days Then two entries returned") {59 val sheet = timesheet {60 someWorkingDay {61 someWorkEntry(timeRange = timeRange1.toParseableString())62 someWorkEntry(timeRange = timeRange2.toParseableString())63 }64 }65 sheet.entries.size shouldBe 266 }67 it("valid work day Then parsed entry returned") {68 val timeStart = LocalTime.of(9, 30)69 val timeEnd = LocalTime.of(10, 0)70 val sheet = timesheet {71 someWorkingDay(someDate) {72 "9:30-10" about description tag (someTag)73 }74 }75 sheet.entries shouldBe TimeEntries.newValidatedOrThrow(76 listOf(77 WorkDayEntry(78 dateRange = EntryDateRange(someDate, TimeRange(timeStart, timeEnd)),79 about = description,80 tags = setOf(someTag),81 )82 )83 )84 }85 it("two tags Then parsed tags returned") {86 val sheet = timesheet {87 someWorkingDay {88 anyTimeRangeString - anyDescription - listOf(tag1, tag2)89 // anyTimeRangeString.about(anyDescription).tags(tag1, tag2)90 }91 }92 sheet.entries.workEntries shouldHaveSize 193 sheet.entries.workEntries[0].tags shouldContainExactly setOf(tag1, tag2)94 }95 it("day off") {96 val sheet = timesheet {97 anyWorkingDay()98 dayOff(date2, someOffReason)99 }100 sheet.entries shouldContain DayOffEntry(101 day = date2,102 reason = someOffReason,103 )104 }105 }106 describe("When ... invalid Then fail") {107 it("no days") {108 failingTimesheet {}109 }110 it("starts with day-off day") {111 failingTimesheet {112 someDayOff()113 }114 }115 it("Given some work day When day-off without reason entry") {116 failingTimesheet {117 anyWorkingDay()118 year(anyYear) {119 month(anyMonth) {120 dayOff(1) // missing: becauseOf reason121 }122 }123 }124 }125 it("two work days with same date") {126 val conflictingDate = TestConstants.someDate127 failingTimesheet {128 someWorkingDay(date = conflictingDate)129 someWorkingDay(date = conflictingDate)130 }.message shouldContain conflictingDate.year.toString().substring(2) shouldContain conflictingDate.monthValue.toString() shouldContain conflictingDate.dayOfMonth.toString()131 }132 // TODO two day offs with same date133 // TODO 1 work day 1 day off; same date134 it("work entry without about") {135 failingTimesheet {136 someWorkingDay(someDate) {137 anyTimeRangeString about " "138 }139 }.message shouldContain someDate.toParsableDate()140 }141 // TODO test 2 days off at same date142 it("two work entries with same time") {143 failingTimesheet {144 someWorkingDay(someDate) {145 someWorkEntry(timeRange = someTimeRangeString)146 someWorkEntry(timeRange = someTimeRangeString)147 }148 }.message shouldContain someDate.toParsableDate() // someTimeRangeString ... unfortunately this info is lost due to dynamic time construction and lack of validation info149 }150 }151 describe("When ... year-month-day") {152 it("When add work-day Then set date correctly") {153 timesheet {154 year(2003) {155 month(Month.of(2)) {156 day(1) {157 someWorkEntry()158 }159 }160 }161 } shouldHaveSingleEntryWithDate LocalDate.of(2003, 2, 1)162 }163 it("Given work-day When add day-off Then set date correctly") {164 val day1 = 1165 val day2 = 2166 val sheet = timesheet {167 year(anyYear) {168 month(anyMonth) {169 day(day1) {170 someWorkEntry()171 }172 someDayOff(day2)173 }174 }175 }176 sheet.entries.size shouldBe 2177 sheet.entries.last().day.dayOfMonth shouldBe day2178 }179 }180 describe("When ... partial time range") {181 it("open end success") {182 val sheet = timesheet {183 someWorkingDay {184 "0-" - "open end entry"185 "1-2" - "last entry"186 }187 }188 sheet.entries.workEntries.size shouldBe 2189 sheet.entries.workEntries.first().dateRange.timeRange shouldBe (0 until 1)190 }191 it("open begin success") {192 val sheet = timesheet {193 someWorkingDay {194 "0-1" - "first entry"195 "-2" - "open begin entry"196 }197 }198 sheet.entries.workEntries.size shouldBe 2199 sheet.entries.workEntries.last().dateRange.timeRange shouldBe (1 until 2)200 }201 it("single open end fail") {202 val exception = failingTimesheet {203 someWorkingDay(LocalDate.of(2003, 2, 1)) {204 "0-" - "open end entry"205 }206 }207 exception.message shouldContain "00:00-"208 exception.message shouldContain "1.2.03"209 }210 it("single end end fail") {211 val exception = failingTimesheet {212 someWorkingDay(LocalDate.of(2003, 2, 1)) {213 "-1" - "open begin entry"214 }215 }216 exception.message shouldContain "1:00"217 exception.message shouldContain "1.2.03"218 }219 // TODO test overlaps220 }221 describe("days off") {222 it("range") {223 val sheet = timesheet {224 year(2000) {225 month(Month.JULY) {226 someWorkingDay(1)227 daysOff(2..3) becauseOf OffReason.any228 }229 }230 }231 sheet.entries shouldHaveSize 3232 sheet.entries[1].shouldBeInstanceOf<DayOffEntry>()233 sheet.entries[2].shouldBeInstanceOf<DayOffEntry>()...

Full Screen

Full Screen

CaPluginTest.kt

Source:CaPluginTest.kt Github

copy

Full Screen

1package family.haschka.wolkenschloss.gradle.ca2import family.haschka.wolkenschloss.testing.Template3import family.haschka.wolkenschloss.testing.createRunner4import io.kotest.assertions.assertSoftly5import io.kotest.core.spec.IsolationMode6import io.kotest.core.spec.style.FunSpec7import io.kotest.engine.spec.tempdir8import io.kotest.matchers.file.shouldBeReadable9import io.kotest.matchers.file.shouldContainFile10import io.kotest.matchers.file.shouldExist11import io.kotest.matchers.file.shouldNotBeWriteable12import io.kotest.matchers.ints.shouldBeGreaterThan13import io.kotest.matchers.shouldBe14import org.bouncycastle.asn1.x500.X500Name15import org.bouncycastle.asn1.x509.KeyUsage16import org.gradle.testkit.runner.TaskOutcome17import java.time.LocalDate18import java.time.LocalTime19import java.time.ZoneOffset20import java.time.ZonedDateTime21import java.util.*22class CaPluginTest : FunSpec({23 autoClose(Template("ca")).withClone {24 context("A project using com.github.wolkenschloss.ca gradle plugin") {25 val xdgDataHome = tempdir()26 val environment = mapOf("XDG_DATA_HOME" to xdgDataHome.absolutePath)27 context("executing ca task") {28 val result = createRunner()29 .withArguments(CaPlugin.CREATE_TASK_NAME)30 .withEnvironment(environment)31 .build()32 test("should be successful") {33 result.task(":${CaPlugin.CREATE_TASK_NAME}")!!.outcome shouldBe TaskOutcome.SUCCESS34 }35 test("should create self signed root certificate") {36 assertSoftly(CertificateWrapper.read(xdgDataHome.resolve("wolkenschloss/ca/ca.crt"))) {37 x509Certificate.basicConstraints shouldBeGreaterThan -138 x509Certificate.basicConstraints shouldBe Int.MAX_VALUE39 keyUsage.hasUsages(KeyUsage.keyCertSign) shouldBe true40 issuer shouldBe X500Name(CaPlugin.TRUST_ANCHOR_DEFAULT_SUBJECT)41 subject shouldBe X500Name(CaPlugin.TRUST_ANCHOR_DEFAULT_SUBJECT)42 }43 }44 test("should create read only certificate") {45 assertSoftly(xdgDataHome.resolve("wolkenschloss/ca/ca.crt")) {46 shouldBeReadable()47 shouldNotBeWriteable()48 }49 }50 test("should create readonly private key") {51 assertSoftly(xdgDataHome.resolve("wolkenschloss/ca/ca.key")) {52 shouldNotBeWriteable()53 shouldBeReadable()54 readPrivateKey().algorithm shouldBe "RSA"55 }56 }57 }58 context("executing truststore task") {59 val result = createRunner()60 .withArguments(CaPlugin.TRUSTSTORE_TASK_NAME)61 .withEnvironment(environment)62 .build()63 test("should execute successfully") {64 result.task(":${CaPlugin.TRUSTSTORE_TASK_NAME}")!!.outcome shouldBe TaskOutcome.SUCCESS65 }66 test("should create truststore file") {67 xdgDataHome.resolve("wolkenschloss/ca/ca.jks").shouldExist()68 }69 }70 test("should customize validity") {71 val start = ZonedDateTime.of(72 LocalDate.of(2022, 2, 4),73 LocalTime.MIDNIGHT,74 ZoneOffset.UTC75 )76 val end = ZonedDateTime.of(77 LocalDate.of(2027, 2, 4),78 LocalTime.MIDNIGHT,79 ZoneOffset.UTC80 )81 val result = createRunner()82 .withArguments(CaPlugin.CREATE_TASK_NAME, "-DnotBefore=$start", "-DnotAfter=$end")83 .withEnvironment(environment)84 .build()85 result.task(":${CaPlugin.CREATE_TASK_NAME}")!!.outcome shouldBe TaskOutcome.SUCCESS86 val certificate = xdgDataHome.resolve("wolkenschloss/ca/ca.crt")87 .readX509Certificate()88 assertSoftly(certificate) {89 notBefore.toUtc() shouldBe start90 notAfter.toUtc() shouldBe end91 }92 }93 test("should create output in user defined location") {94 val result = createRunner()95 .withArguments("createInUserDefinedLocation")96 .withEnvironment(environment)97 .build()98 result.task(":createInUserDefinedLocation")!!.outcome shouldBe TaskOutcome.SUCCESS99 assertSoftly(workingDirectory.resolve("build/ca")) {100 shouldContainFile("ca.crt")101 shouldContainFile("ca.key")102 }103 }104 }105 }106}) {107 override fun isolationMode(): IsolationMode = IsolationMode.InstancePerLeaf...

Full Screen

Full Screen

FinishRideUseCaseTest.kt

Source:FinishRideUseCaseTest.kt Github

copy

Full Screen

...7import com.stringconcat.kirillov.carsharing.ride.domain.RideFinishedEvent8import com.stringconcat.kirillov.carsharing.ride.domain.RideStatus.FINISHED9import com.stringconcat.kirillov.carsharing.ride.usecase.ride.FinishRideUseCaseError.RideAlreadyFinishedError10import com.stringconcat.kirillov.carsharing.ride.usecase.ride.FinishRideUseCaseError.RideNotFound11import io.kotest.assertions.arrow.either.shouldBeLeft12import io.kotest.assertions.arrow.either.shouldBeRight13import io.kotest.matchers.collections.shouldContainExactly14import io.kotest.matchers.nulls.shouldBeNull15import io.kotest.matchers.nulls.shouldNotBeNull16import io.kotest.matchers.should17import io.kotest.matchers.shouldBe18import java.time.LocalDate.EPOCH19import java.time.LocalTime.MIDNIGHT20import java.time.OffsetDateTime21import java.time.ZoneOffset.UTC22import org.junit.jupiter.api.Test23internal class FinishRideUseCaseTest {24 private val coveredDistance = randomDistance()25 private val finishedDateTime = OffsetDateTime.of(EPOCH, MIDNIGHT, UTC)26 @Test27 fun `should finish started ride`() {28 val startedRide = startedRide()29 val persister = InMemoryRideRepository()30 val usecase = FinishRideUseCase(31 extractor = InMemoryRideRepository().apply {...

Full Screen

Full Screen

HotelControllerTest.kt

Source:HotelControllerTest.kt Github

copy

Full Screen

1package hotel2import arrow.core.Either3import hotel.exception.RoomNotExistException4import hotel.model.Booking5import io.kotest.assertions.arrow.core.shouldBeRight6import io.kotest.assertions.throwables.shouldThrowExactly7import io.kotest.inspectors.forExactly8import io.kotest.matchers.date.shouldBeAfter9import io.kotest.matchers.should10import io.kotest.matchers.string.include11import kotlinx.coroutines.DelicateCoroutinesApi12import kotlinx.coroutines.GlobalScope13import kotlinx.coroutines.async14import kotlinx.coroutines.runBlocking15import org.junit.jupiter.api.Test16import java.time.Clock17import java.time.LocalDate18import java.time.ZoneId19private const val THREADS = 100020private val DATE = LocalDate.of(2021, 11, 7)21private val zoneId = ZoneId.systemDefault()22private val clockYesterday = Clock.fixed(DATE.minusDays(1).atStartOfDay().atZone(zoneId).toInstant(), zoneId)23@DelicateCoroutinesApi24internal class HotelControllerTest {...

Full Screen

Full Screen

FlatsGeneratorTest.kt

Source:FlatsGeneratorTest.kt Github

copy

Full Screen

1package ktor.simple.rest.service.flat.utils2import io.kotest.matchers.collections.shouldNotBeEmpty3import io.kotest.matchers.nulls.shouldNotBeNull4import io.kotest.matchers.shouldBe5import org.junit.jupiter.api.Test6import java.time.Duration7import java.time.LocalDateTime8import java.time.LocalTime9class FlatsGeneratorTest {10 private val generator = FlatsGenerator()11 private val firstAvailableSlotTime = LocalDateTime.parse("2020-01-01T10:00")12 @Test13 fun `produced flat -- has slots for the 7 upcoming days`() {14 val daysSchedules = generator.generateFlat(firstAvailableSlotTime).schedules15 daysSchedules.shouldNotBeEmpty()16 val firstDayTime = daysSchedules.first().dateOfTheDay.atStartOfDay()17 val latDayTime = daysSchedules.last().dateOfTheDay.atStartOfDay()18 // current + 6 upcoming...

Full Screen

Full Screen

DayScheduleTest.kt

Source:DayScheduleTest.kt Github

copy

Full Screen

1package eu.kowalcze.michal.arch.clean.example.domain.model2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.matchers.shouldBe4import org.junit.jupiter.api.Test5import java.time.LocalDate6import java.time.LocalTime7internal class DayScheduleTest {8 @Test9 fun `Should reserve a slot`() {10 // given11 val today = LocalDate.now()12 val givenSchedule =13 DaySchedule(today, listOf(Slot(reserved = false, start = LocalTime.MIN, end = LocalTime.MAX)))14 // when15 val daySchedule = givenSchedule.reserveSlot(0)16 // then17 daySchedule.slots[0].reserved shouldBe true...

Full Screen

Full Screen

DateTest.kt

Source:DateTest.kt Github

copy

Full Screen

1package com.github.cpickl.timesheet.builder2import io.kotest.core.spec.style.DescribeSpec3import io.kotest.matchers.shouldBe4import java.time.LocalDate5import java.time.LocalTime6class DateTest : DescribeSpec() {7 init {8 describe("LocalDate.toParseableString") {9 it("sunshine") {10 val date = LocalDate.of(2003, 2, 1)11 date.toParsableDate() shouldBe "1.2.03"12 }13 }14 describe("LocalTime.toParseableString()") {15 LocalTime.of(1, 2).toParseableString() shouldBe "01:02"16 LocalTime.of(21, 42).toParseableString() shouldBe "21:42"17 }...

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 fun testLocalTime() {2 val time = LocalTime.now()3 time.shouldBeLocalTime()4 }5 fun testLocalDate() {6 val date = LocalDate.now()7 date.shouldBeLocalDate()8 }9 fun testLocalDateTime() {10 val dateTime = LocalDateTime.now()11 dateTime.shouldBeLocalDateTime()12 }13 fun testOffsetDateTime() {14 val offsetDateTime = OffsetDateTime.now()15 offsetDateTime.shouldBeOffsetDateTime()16 }17 fun testZonedDateTime() {18 val zonedDateTime = ZonedDateTime.now()19 zonedDateTime.shouldBeZonedDateTime()20 }21 fun testOffsetTime() {22 val offsetTime = OffsetTime.now()23 offsetTime.shouldBeOffsetTime()24 }25 fun testDuration() {26 val duration = Duration.ofHours(1)27 duration.shouldBeDuration()28 }29 fun testInstant() {30 val instant = Instant.now()31 instant.shouldBeInstant()32 }33 fun testPeriod() {34 val period = Period.of(1, 1, 1)35 period.shouldBePeriod()36 }37 fun testYear() {38 val year = Year.now()39 year.shouldBeYear()40 }41 fun testYearMonth() {

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1val localTime = LocalTime.now()2localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))3val localTime = LocalTime.now()4localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))5val localTime = LocalTime.now()6localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))7val localTime = LocalTime.now()8localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))9val localTime = LocalTime.now()10localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))11val localTime = LocalTime.now()12localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))13val localTime = LocalTime.now()14localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))15val localTime = LocalTime.now()16localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))17val localTime = LocalTime.now()18localTime.shouldBeBetween(LocalTime.of(23, 59, 59), LocalTime.of(23, 59, 59))19val localTime = LocalTime.now()

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1val date = LocalDateTime.of(2021, 4, 28, 0, 0, 0)2date.shouldBeBefore(LocalDateTime.of(2021, 4, 29, 0, 0, 0))3date.shouldBeBeforeOrEqual(LocalDateTime.of(2021, 4, 28, 0, 0, 0))4date.shouldBeAfter(LocalDateTime.of(2021, 4, 27, 0, 0, 0))5date.shouldBeAfterOrEqual(LocalDateTime.of(2021, 4, 28, 0, 0, 0))6date.shouldBeBetween(LocalDateTime.of(2021, 4, 27, 0, 0, 0), LocalDateTime.of(2021, 4, 29, 0, 0, 0))7date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 27, 0, 0, 0), LocalDateTime.of(2021, 4, 28, 0, 0, 0))8date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 28, 0, 0, 0), LocalDateTime.of(2021, 4, 29, 0, 0, 0))9date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 27, 0, 0, 0), LocalDateTime.of(2021, 4, 28, 0, 0, 0))10date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 28, 0, 0, 0), LocalDateTime.of(2021, 4, 29, 0, 0, 0))11date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 27, 0, 0, 0), LocalDateTime.of(2021, 4, 28, 0, 0, 0))12date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 28, 0, 0, 0), LocalDateTime.of(2021, 4, 29, 0, 0, 0))13date.shouldBeBetweenOrEqual(LocalDateTime.of(2021, 4, 27, 0, 0,

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1localtime should beBeforeOrEqual(localtime.plusHours(1))2localdatetime should beBeforeOrEqual(localdatetime.plusHours(1))3localdate should beBeforeOrEqual(localdate.plusDays(1))4localtime should beBeforeOrEqual(localtime.plusHours(1))5localdatetime should beBeforeOrEqual(localdatetime.plusHours(1))6localdate should beBeforeOrEqual(localdate.plusDays(1))7localtime should beBeforeOrEqual(localtime.plusHours(1))8localdatetime should beBeforeOrEqual(localdatetime.plusHours(1))9localdate should beBeforeOrEqual(localdate.plusDays(1))10localtime should beBeforeOrEqual(localtime.plusHours(1))11localdatetime should beBeforeOrEqual(localdatetime.plusHours(1))12localdate should beBeforeOrEqual(localdate.plusDays(1))13localtime should beBeforeOrEqual(localtime.plusHours(1))14localdatetime should beBeforeOrEqual(localdatetime.plusHours(1))15localdate should beBeforeOrEqual(localdate.plusDays(1))16localtime should beBeforeOrEqual(localtime.plusHours(1))

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 fun `test local time`() {2 val localTime = LocalTime.of(13, 20, 30)3 localTime.shouldBe(LocalTime.of(13, 20, 30))4 }5}6 fun `test local date time`() {7 val localDateTime = LocalDateTime.of(2020, 9, 2, 13, 20, 30)8 localDateTime.shouldBe(LocalDateTime.of(2020, 9, 2, 13, 20, 30))9 }10}11 fun `test zoned date time`() {12 val zonedDateTime = ZonedDateTime.of(2020, 9, 2, 13, 20, 30, 0, ZoneId.of("Asia/Tokyo"))13 zonedDateTime.shouldBe(ZonedDateTime.of(2020, 9, 2, 13, 20, 30, 0, ZoneId.of("Asia/Tokyo")))14 }15}16 fun `test period`() {17 val period = Period.of(1, 2, 3)18 period.shouldBe(Period.of(1, 2, 3))19 }20}21 fun `test duration`() {22 val duration = Duration.of(1, ChronoUnit.DAYS)23 duration.shouldBe(Duration.of(1, ChronoUnit.DAYS))24 }25}26 fun `test instant`() {27 val instant = Instant.ofEpochSecond(1)28 instant.shouldBe(Instant.ofEpochSecond(1))29 }30}31 fun `test temporal`() {32 val temporal = LocalDate.of(2020, 9, 2)33 temporal.shouldBe(LocalDate.of(2020, 9, 2))34 }35}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful