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

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

DataClassAssertions.kt

Source:DataClassAssertions.kt Github

copy

Full Screen

1package com.phauer.unittestkotlin2import io.kotest.assertions.asClue3import io.kotest.matchers.collections.shouldContainExactly4import io.kotest.matchers.equality.shouldBeEqualToIgnoringFields5import io.kotest.matchers.equality.shouldBeEqualToUsingFields6import io.kotest.matchers.shouldBe7import org.assertj.core.api.Assertions.assertThat8import org.junit.jupiter.api.Test9class DataClassAssertions {10 //Don't11 @Test12 fun test() {13 val client = DesignClient()14 val actualDesign = client.requestDesign(id = 1)15 assertThat(actualDesign.id).isEqualTo(2)16 assertThat(actualDesign.userId).isEqualTo(9)17 assertThat(actualDesign.name).isEqualTo("Cat")18 /*19 org.junit.ComparisonFailure: expected:<[2]> but was:<[1]>20 Expected :221 Actual :122 */23 }24 @Test25 fun test_kotest() {26 val client = DesignClient()27 val actualDesign = client.requestDesign(id = 1)28 actualDesign.id shouldBe 2 // ComparisonFailure29 actualDesign.userId shouldBe 930 actualDesign.name shouldBe "Cat"31 /*32 org.opentest4j.AssertionFailedError: expected:<2> but was:<1>33 Expected :234 Actual :135 */36 }37 //Do38 @Test39 fun test2() {40 val client = DesignClient()41 val actualDesign = client.requestDesign(id = 1)42 val expectedDesign = Design(43 id = 2,44 userId = 9,45 name = "Cat"46 )47 assertThat(actualDesign).isEqualTo(expectedDesign)48 /*49 org.junit.ComparisonFailure: expected:<Design(id=[2], userId=9, name=Cat...> but was:<Design(id=[1], userId=9, name=Cat...>50 Expected :Design(id=2, userId=9, name=Cat)51 Actual :Design(id=1, userId=9, name=Cat)52 */53 }54 @Test55 fun test2_kotest() {56 val client = DesignClient()57 val actualDesign = client.requestDesign(id = 1)58 val expectedDesign = Design(59 id = 2,60 userId = 9,61 name = "Cat"62 )63 actualDesign shouldBe expectedDesign64 /*65 org.opentest4j.AssertionFailedError: data class diff for de.philipphauer.blog.unittestkotlin.Design66 └ id: expected:<2> but was:<1>67 expected:<Design(id=2, userId=9, name=Cat)> but was:<Design(id=1, userId=9, name=Cat)>68 Expected :Design(id=2, userId=9, name=Cat)69 Actual :Design(id=1, userId=9, name=Cat)70 */71 }72 //Do73 @Test74 fun lists() {75 val client = DesignClient()76 val actualDesigns = client.getAllDesigns()77 assertThat(actualDesigns).containsExactly(78 Design(79 id = 1,80 userId = 9,81 name = "Cat"82 ),83 Design(84 id = 2,85 userId = 4,86 name = "Dog"87 )88 )89 /*90 java.lang.AssertionError:91 Expecting:92 <[Design(id=1, userId=9, name=Cat),93 Design(id=2, userId=4, name=Dogggg)]>94 to contain exactly (and in same order):95 <[Design(id=1, userId=9, name=Cat),96 Design(id=2, userId=4, name=Dog)]>97 but some elements were not found:98 <[Design(id=2, userId=4, name=Dog)]>99 and others were not expected:100 <[Design(id=2, userId=4, name=Dogggg)]>101 */102 }103 @Test104 fun lists_kotest() {105 val client = DesignClient()106 val actualDesigns = client.getAllDesigns()107 actualDesigns.shouldContainExactly(108 Design(109 id = 1,110 userId = 9,111 name = "Cat"112 ),113 Design(114 id = 2,115 userId = 4,116 name = "Dog"117 )118 )119 /*120 java.lang.AssertionError: Expecting: [121 Design(id=1, userId=9, name=Cat),122 Design(id=2, userId=4, name=Dog)123 ] but was: [124 Design(id=1, userId=9, name=Cat),125 Design(id=2, userId=4, name=Dogggg)126 ]127 Some elements were missing: [128 Design(id=2, userId=4, name=Dog)129 ] and some elements were unexpected: [130 Design(id=2, userId=4, name=Dogggg)131 ]132 */133 }134 @Test135 fun sophisticatedAssertions_single() {136 val client = DesignClient()137 val actualDesign = client.requestDesign(id = 1)138 val expectedDesign = Design(139 id = 2,140 userId = 9,141 name = "Cat"142 )143 assertThat(actualDesign).isEqualToIgnoringGivenFields(expectedDesign, "id")144 assertThat(actualDesign).isEqualToComparingOnlyGivenFields(expectedDesign, "userId", "name")145 }146 @Test147 fun sophisticatedAssertions_single_kotest() {148 val client = DesignClient()149 val actualDesign = client.requestDesign(id = 1)150 val expectedDesign = Design(151 id = 2,152 userId = 9,153 name = "Cat"154 )155 actualDesign.shouldBeEqualToIgnoringFields(expectedDesign, Design::id)156 actualDesign.shouldBeEqualToUsingFields(expectedDesign, Design::userId, Design::name)157 }158 @Test159 fun sophisticatedAssertions_lists() {160 val client = DesignClient()161 val actualDesigns = client.getAllDesigns()162 assertThat(actualDesigns).usingElementComparatorIgnoringFields("dateCreated").containsExactly(163 Design(164 id = 1,165 userId = 9,166 name = "Cat"167 ),168 Design(169 id = 2,170 userId = 4,171 name = "Dog"172 )173 )174 assertThat(actualDesigns).usingElementComparatorOnFields("userId", "name").containsExactly(175 Design(176 id = 1,177 userId = 9,178 name = "Cat"179 ),180 Design(181 id = 2,182 userId = 4,183 name = "Dog"184 )185 )186 }187 @Test188 fun sophisticatedAssertions_lists_kotest() {189 val client = DesignClient()190 val actualDesigns = client.getAllDesigns()191 // TODO doesn't seem to exist in kotest yet192// assertThat(actualDesigns).usingElementComparatorIgnoringFields("dateCreated").containsExactly(193// Design(id = 1, userId = 9, name = "Cat", dateCreated = Instant.ofEpochSecond(1518278198)),194// Design(id = 2, userId = 4, name = "Dogggg", dateCreated = Instant.ofEpochSecond(1518279000))195// )196// assertThat(actualDesigns).usingElementComparatorOnFields("id", "name").containsExactly(197// Design(id = 1, userId = 9, name = "Cat", dateCreated = Instant.ofEpochSecond(1518278198)),198// Design(id = 2, userId = 4, name = "Dogggg", dateCreated = Instant.ofEpochSecond(1518279000))199// )200 }201 @Test202 fun grouping() {203 val client = DesignClient()204 val actualDesign = client.requestDesign(id = 1)205 actualDesign.asClue {206 it.id shouldBe 2207 it.userId shouldBe 9208 it.name shouldBe "Cat"209 }210 /**211 * org.opentest4j.AssertionFailedError: Design(id=1, userId=9, name=Cat, dateCreated=2018-02-10T15:56:38Z)212 expected:<2> but was:<1>213 Expected :2214 Actual :1215 */216 }217}218data class Design(219 val id: Int,220 val userId: Int,221 val name: String222)223class DesignClient {224 fun requestDesign(id: Int) =225 Design(...

Full Screen

Full Screen

WaltIdJwtCredentialServiceTest.kt

Source:WaltIdJwtCredentialServiceTest.kt Github

copy

Full Screen

...11import id.walt.signatory.DataProviderRegistry12import id.walt.signatory.ProofConfig13import id.walt.signatory.ProofType14import id.walt.signatory.Signatory15import id.walt.test.DummySignatoryDataProvider16import id.walt.test.RESOURCES_PATH17import id.walt.vclib.Helpers.encode18import id.walt.vclib.credentials.Europass19import id.walt.vclib.credentials.VerifiableId20import io.kotest.core.spec.style.AnnotationSpec21import io.kotest.matchers.collections.shouldContain22import io.kotest.matchers.maps.shouldContainKey23//ANDROID PORT24import java.io.File25import java.io.FileInputStream26//ANDROID PORT27import io.kotest.matchers.shouldBe28import io.kotest.matchers.shouldNotBe29import java.time.LocalDateTime30import java.time.ZoneOffset31import java.util.*32class WaltIdJwtCredentialServiceTest : AnnotationSpec() {33 init {34 //ANDROID PORT35 AndroidUtils.setAndroidDataDir(System.getProperty("user.dir"))36 ServiceMatrix(FileInputStream(File("$RESOURCES_PATH/service-matrix.properties")))37 //ANDROID PORT38 }39 private val credentialService = JwtCredentialService.getService()40 private val jwtService = JwtService.getService()41 private val keyId = KeyService.getService().generate(KeyAlgorithm.ECDSA_Secp256k1)42 private val id = "education#higherEducation#51e42fda-cb0a-4333-b6a6-35cb147e1a88"43 private val issuerDid = DidService.create(DidMethod.ebsi, keyId.id)44 private val subjectDid = "did:ebsi:22AhtW7XMssv7es4YcQTdV2MCM3c8b1VsiBfi5weHsjcCY9o"45 private val issueDate = LocalDateTime.now()46 private val validDate = issueDate.minusDays(1)47 private val expirationDate = issueDate.plusDays(1)48 @AfterAll49 fun tearDown() {50 // Only required if file-key store is used51// val didFilename = "${issuerDid.replace(":", "-")}.json"52// Files.delete(Path.of("data", "did", "created", didFilename))53 KeyService.getService().delete(keyId.id)54 }55 @Test56 //ANDROID PORT57 @Ignore //Android Secp256k1 JNI58 //ANDROID PORT59 fun testSignedVcAttributes() {60 val credential = credentialService.sign(61 Europass().encode(),62 ProofConfig(63 credentialId = id,64 issuerDid = issuerDid,65 subjectDid = subjectDid,66 issueDate = issueDate,67 validDate = validDate,68 expirationDate = expirationDate69 )70 )71 val claims = jwtService.parseClaims(credential)!!72 claims["jti"] shouldBe id73 claims["iss"] shouldBe issuerDid74 claims["sub"] shouldBe subjectDid75 (claims["iat"] as Date).toInstant().epochSecond shouldBe issueDate.toInstant(ZoneOffset.UTC).epochSecond76 (claims["nbf"] as Date).toInstant().epochSecond shouldBe validDate.toInstant(ZoneOffset.UTC).epochSecond77 (claims["exp"] as Date).toInstant().epochSecond shouldBe expirationDate.toInstant(ZoneOffset.UTC).epochSecond78 claims shouldContainKey "vc"79 claims["vc"].let {80 it as Map<*, *>81 it.keys.size shouldBe 282 it.keys.forEach { listOf("@context", "type") shouldContain it }83 it["@context"] shouldBe listOf("https://www.w3.org/2018/credentials/v1")84 it["type"] shouldBe listOf("VerifiableCredential", "VerifiableAttestation", "Europass")85 }86 }87 @Test88 //ANDROID PORT89 @Ignore //Android Secp256k1 JNI90 //ANDROID PORT91 fun testOptionalConfigsAreNull() {92 val claims = jwtService.parseClaims(93 credentialService.sign(Europass().encode(), ProofConfig(issuerDid = issuerDid))94 )!!95 claims["jti"] shouldBe null96 claims["iss"] shouldBe issuerDid97 claims["sub"] shouldBe null98 claims["iat"] shouldNotBe null99 claims["nbf"] shouldNotBe null100 claims["exp"] shouldBe null101 claims shouldContainKey "vc"102 }103 @Test104 //ANDROID PORT105 @Ignore //Android Secp256k1 JNI106 //ANDROID PORT107 fun testVerifyVc() = credentialService.verifyVc(108 credentialService.sign(Europass().encode(), ProofConfig(issuerDid = issuerDid))109 ) shouldBe true110 @Test111 //ANDROID PORT112 @Ignore //Android Secp256k1 JNI113 //ANDROID PORT114 fun testVerifyVcWithIssuerDid() = credentialService.verifyVc(115 issuerDid,116 credentialService.sign(Europass().encode(), ProofConfig(issuerDid = issuerDid))117 ) shouldBe true118 @Test119 //ANDROID PORT120 @Ignore //Android Secp256k1 JNI121 //ANDROID PORT122 fun testVerifyVcWithWrongIssuerDid() = credentialService.verifyVc(123 "wrong",124 credentialService.sign(Europass().encode(), ProofConfig(issuerDid = issuerDid)125 )126 ) shouldBe false127 @Test128 fun testValidateSchema() {129 // Required at the moment because EBSI did not upgrade V_ID schema with necessary changes.130 DataProviderRegistry.register(VerifiableId::class, DummySignatoryDataProvider())131 val noSchemaVc = VerifiableId().encode()132 val validVc = Signatory.getService().issue("VerifiableId", ProofConfig(issuerDid = issuerDid, subjectDid = issuerDid, proofType = ProofType.JWT))133 val invalidDataVc = Signatory.getService().issue("VerifiableId", ProofConfig(issuerDid = issuerDid, proofType = ProofType.JWT))134 val notParsableVc = ""135 credentialService.validateSchemaTsr(noSchemaVc) shouldBe true136 credentialService.validateSchemaTsr(validVc) shouldBe true137 credentialService.validateSchemaTsr(invalidDataVc) shouldBe false138 credentialService.validateSchemaTsr(notParsableVc) shouldBe false139 }140}...

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

EmoticonServiceSpec.kt

Source:EmoticonServiceSpec.kt Github

copy

Full Screen

1package com.kakao.ifkakao.studio.test.domain.emoticon2import com.kakao.ifkakao.studio.domain.emoticon.EmoticonInformation3import com.kakao.ifkakao.studio.domain.emoticon.EmoticonRepository4import com.kakao.ifkakao.studio.domain.emoticon.EmoticonService5import com.kakao.ifkakao.studio.test.Mock6import com.kakao.ifkakao.studio.test.SpringDataConfig7import io.kotest.core.spec.style.ExpectSpec8import io.kotest.matchers.collections.shouldContainAll9import io.kotest.matchers.collections.shouldHaveSize10import io.kotest.matchers.longs.shouldBeGreaterThan11import io.kotest.matchers.shouldBe12import io.kotest.property.Arb13import io.kotest.property.arbitrary.chunked14import io.kotest.property.arbitrary.flatMap15import io.kotest.property.arbitrary.int16import io.kotest.property.arbitrary.localDate17import io.kotest.property.arbitrary.single18import io.kotest.property.arbitrary.string19import io.kotest.property.arbitrary.stringPattern20import org.springframework.test.context.ContextConfiguration21import java.time.LocalDate22import java.time.ZoneId23@ContextConfiguration(classes = [SpringDataConfig::class])24class EmoticonServiceSpec(25 private val emoticonRepository: EmoticonRepository26) : ExpectSpec() {27 private val emoticonService = EmoticonService(repository = emoticonRepository)28 init {29 context("이모티콘 생성을 할 때") {30 val account = Mock.account(identified = true)31 val information = information()32 val images = images()33 expect("계정과 이모티콘 정보, 이미지가 있으면 이모티콘이 생성된다.") {34 val emoticon = emoticonService.create(account, information, images)...

Full Screen

Full Screen

TemporalSerializerTest.kt

Source:TemporalSerializerTest.kt Github

copy

Full Screen

1package com.github.agcom.bson.serialization.serializers2import com.github.agcom.bson.serialization.BsonInstanceTest3import com.github.agcom.bson.serialization.BsonInstanceTestDefault4import io.kotest.core.spec.style.FreeSpec5import io.kotest.matchers.shouldBe6import io.kotest.matchers.types.shouldBeInstanceOf7import org.bson.BsonDateTime8import java.time.*9import java.time.temporal.TemporalAccessor10class TemporalSerializerTest : FreeSpec(), BsonInstanceTest by BsonInstanceTestDefault() {11 private val testInstant = Instant.now()12 private inline infix fun <reified T : TemporalAccessor> TemporalAccessorSerializer<T>.shouldBeOk(testTime: T) {13 val serializer = this14 val testMillis = serializer.toEpochMillis(testTime)15 val encoded = bson.toBson(serializer, testTime)16 encoded.shouldBeInstanceOf<BsonDateTime>(); encoded as BsonDateTime17 encoded.value shouldBe testMillis18 val decoded = bson.fromBson(serializer, encoded)19 serializer.toEpochMillis(decoded) shouldBe testMillis20 }21 init {22 "temporal" {23 TemporalAccessorSerializer shouldBeOk testInstant24 }25 "instant" {26 InstantSerializer shouldBeOk testInstant27 }28 "local date time" {29 LocalDateTimeSerializer shouldBeOk LocalDateTime.ofInstant(testInstant, ZoneId.systemDefault())30 }31 "local date" {32 LocalDateSerializer shouldBeOk LocalDateTime.ofInstant(testInstant, ZoneId.systemDefault()).toLocalDate()33 }34 "local time" {35 LocalTimeSerializer shouldBeOk LocalDateTime.ofInstant(testInstant, ZoneId.systemDefault()).toLocalTime()36 }37 "offset date time" {38 OffsetDateTimeSerializer shouldBeOk OffsetDateTime.ofInstant(testInstant, ZoneId.systemDefault())39 }40 "offset time" {41 OffsetTimeSerializer shouldBeOk OffsetTime.ofInstant(testInstant, ZoneId.systemDefault())42 }43 "zoned date time" {44 ZonedDateTimeSerializer shouldBeOk ZonedDateTime.ofInstant(testInstant, ZoneId.systemDefault())45 }46 }47}...

Full Screen

Full Screen

CreateTrialUserImplTest.kt

Source:CreateTrialUserImplTest.kt Github

copy

Full Screen

1package com.falcon.falcon.core.usecase.trial2import com.falcon.falcon.core.entity.User3import com.falcon.falcon.core.enumeration.UserType4import com.falcon.falcon.core.usecase.user.CreateUserUseCase5import io.kotest.matchers.date.shouldBeBetween6import io.kotest.matchers.shouldBe7import io.kotest.matchers.string.shouldBeUUID8import io.kotest.matchers.types.shouldBeTypeOf9import io.mockk.clearAllMocks10import io.mockk.every11import io.mockk.mockk12import org.junit.jupiter.api.BeforeEach13import org.junit.jupiter.api.Test14import org.junit.jupiter.api.TestInstance15import java.time.Instant16import java.time.temporal.ChronoUnit17@TestInstance(TestInstance.Lifecycle.PER_CLASS)18internal class CreateTrialUserImplTest {19 private val createUserUseCase: CreateUserUseCase = mockk()20 private val trialDuration = 1L21 private val underTest: CreateTrialUserImpl = CreateTrialUserImpl(createUserUseCase, trialDuration)22 @BeforeEach...

Full Screen

Full Screen

TypeConvertersTest.kt

Source:TypeConvertersTest.kt Github

copy

Full Screen

1package com.github.pintowar.conf2import io.kotest.core.spec.style.StringSpec3import io.kotest.data.forAll4import io.kotest.data.row5import io.kotest.matchers.shouldBe6import java.time.LocalDateTime7import java.time.YearMonth8import java.time.ZoneId9import java.util.*10class TypeConvertersTest : StringSpec({11 val conversor = TypeConverters()12 "periodDateTypeConverter" {13 val converter = conversor.periodDateTypeConverter()14 forAll(15 row(2022, 2, "2022-02-01T00:00:00.000"),16 row(2020, 5, "2020-05-01T00:00:00.000"),17 row(2021, 1, "2021-01-01T00:00:00.000")18 ) { year, month, instant ->19 val res = converter.convert(YearMonth.of(year, month), Date::class.java).get()...

Full Screen

Full Screen

PingTest.kt

Source:PingTest.kt Github

copy

Full Screen

1package no.arcane.platform.tests2import io.kotest.core.spec.style.StringSpec3import io.kotest.matchers.date.shouldBeAfter4import io.kotest.matchers.date.shouldBeBefore5import io.kotest.matchers.shouldBe6import io.ktor.client.call.*7import io.ktor.client.request.*8import java.time.Instant9import java.util.*10class PingTest : StringSpec({11 "GET /ping" {12 val response: String = apiClient.get {13 url(path = "ping")14 }.body()15 response shouldBe "pong"16 }17 "POST /ping" {18 val response: String = apiClient.post {19 url(path = "ping")...

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1import io.kotest.matchers.date.instant.shouldBeAfter2import io.kotest.matchers.date.instant.shouldBeBefore3import io.kotest.matchers.date.instant.shouldBeBetween4import io.kotest.matchers.date.instant.shouldBeEqualComparingTo5import io.kotest.matchers.date.instant.shouldBeEqualIncludingNanos6import io.kotest.matchers.date.instant.shouldBeEqualIgnoringNanos7import io.kotest.matchers.date.instant.shouldBeEqualOrAfter8import io.kotest.matchers.date.instant.shouldBeEqualOrBefore9import io.kotest.matchers.date.instant.shouldBeGreaterThan10import io.kotest.matchers.date.instant.shouldBeGreaterThanOrEqual11import io.kotest.matchers.date.instant.shouldBeLessThan12import io.kotest.matchers.date.instant.shouldBeLessThanOrEqual13import io.kotest.matchers.date.instant.shouldBeNear14import io.kotest.matchers.date.instant.shouldBeOnOrAfter15import io.kotest.matchers.date.instant.shouldBeOnOrBefore16import io.kotest.matchers.date.instant.shouldBeOnSameDayAs17import io.kotest.matchers.date.instant.shouldBeOnSameInstantAs18import io.kotest.matchers.date.instant.shouldBeOnSameMonthAs19import io.kotest.matchers.date.instant.shouldBeOnSameYearAs20import io.kotest.matchers.date.instant.shouldBeSameDayAs21import io.kotest.matchers.date.instant.shouldBeSameInstantAs22import io.kotest.matchers.date.instant.shouldBeSameMonthAs23import io.kotest.matchers.date.instant.shouldBeSameYearAs24import io.kotest.matchers.date.instant.shouldBeToday25import io.kotest.matchers.date.instant.shouldBeTomorrow26import io.kotest.matchers.date.instant.shouldBeWithin27import io.kotest.matchers.date.instant.shouldBeYesterday28import io.kotest.matchers.date.instant.shouldNotBeAfter29import io.kotest.matchers.date.instant.shouldNotBeBefore30import io.kotest.matchers.date.instant.shouldNotBeBetween31import io.kotest.matchers.date.instant.shouldNotBeEqualComparingTo32import io.kotest.matchers.date.instant.shouldNotBeEqualIncludingNanos33import io.kotest.matchers.date.instant.shouldNotBeEqualIgnoringNanos34import io.kotest.matchers.date.instant.shouldNotBe

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1+import io.kotest.matchers.date.instant.shouldBeAfter2+import io.kotest.matchers.date.instant.shouldBeBefore3+import io.kotest.matchers.date.instant.shouldBeBetween4+import io.kotest.matchers.date.instant.shouldBeSameDayAs5+import io.kotest.matchers.date.instant.shouldBeSameHourAs6+import io.kotest.matchers.date.instant.shouldBeSameMinuteAs7+import io.kotest.matchers.date.instant.shouldBeSameMonthAs8+import io.kotest.matchers.date.instant.shouldBeSameSecondAs9+import io.kotest.matchers.date.instant.shouldBeSameYearAs10+import io.kotest.matchers.date.instant.shouldBeToday11+import io.kotest.matchers.date.instant.shouldBeTomorrow12+import io.kotest.matchers.date.instant.shouldBeYesterday13+import io.kotest.matchers.date.instant.shouldBeWithin14+import io.kotest.matchers.date.instant.shouldNotBeAfter15+import io.kotest.matchers.date.instant.shouldNotBeBefore16+import io.kotest.matchers.date.instant.shouldNotBeBetween17+import io.kotest.matchers.date.instant.shouldNotBeSameDayAs18+import io.kotest.matchers.date.instant.shouldNotBeSameHourAs19+import io.kotest.matchers.date.instant.shouldNotBeSameMinuteAs20+import io.kotest.matchers.date.instant.shouldNotBeSameMonthAs21+import io.kotest.matchers.date.instant.shouldNotBeSameSecondAs22+import io.kotest.matchers.date.instant.shouldNotBeSameYearAs23+import io.kotest.matchers.date.instant.shouldNotBeToday24+import io.kotest.matchers.date.instant.shouldNotBeTomorrow25+import io.kotest.matchers.date.instant.shouldNotBeYesterday26+import io.kotest.matchers.date.instant.shouldNotBeWithin27+import io.kotest.matchers.date.localdate.shouldBeAfter28+import io.kotest.matchers.date.localdate.shouldBeBefore29+import io.kotest.matchers.date.localdate.shouldBeBetween30+import io.kotest.matchers.date.localdate.shouldBeSameDayAs31+import io.kotest.matchers.date.localdate.shouldBeSameMonthAs32+import io.kotest.matchers.date.localdate.shouldBeSameYearAs

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1+import io.kotest.matchers.date.instant.shouldBeBefore2+import io.kotest.matchers.date.instant.shouldBeBeforeOrEqual3+import io.kotest.matchers.date.instant.shouldBeAfter4+import io.kotest.matchers.date.instant.shouldBeAfterOrEqual5+import io.kotest.matchers.date.instant.shouldBeBetween6+import io.kotest.matchers.date.instant.shouldNotBeBetween7+import io.kotest.matchers.date.localdate.shouldBeBefore8+import io.kotest.matchers.date.localdate.shouldBeBeforeOrEqual9+import io.kotest.matchers.date.localdate.shouldBeAfter10+import io.kotest.matchers.date.localdate.shouldBeAfterOrEqual11+import io.kotest.matchers.date.localdate.shouldBeBetween12+import io.kotest.matchers.date.localdate.shouldNotBeBetween13+import io.kotest.matchers.date.localdatetime.shouldBeBefore14+import io.kotest.matchers.date.localdatetime.shouldBeBeforeOrEqual15+import io.kotest.matchers.date.localdatetime.shouldBeAfter16+import io.kotest.matchers.date.localdatetime.shouldBeAfterOrEqual17+import io.kotest.matchers.date.localdatetime.shouldBeBetween18+import io.kotest.matchers.date.localdatetime.shouldNotBeBetween19+import io.kotest.matchers.date.localtime.shouldBeBefore20+import io.kotest.matchers.date.localtime.shouldBeBeforeOrEqual21+import io.kotest.matchers.date.localtime.shouldBeAfter22+import io.kotest.matchers.date.localtime.shouldBeAfterOrEqual23+import io.kotest.matchers.date.localtime.shouldBeBetween24+import io.kotest.matchers.date.localtime.shouldNotBeBetween25+import io.kotest.matchers.date.localtimetz.shouldBeBefore26+import io.kotest.matchers.date.localtimetz.shouldBeBeforeOrEqual27+import io.kotest.matchers.date.localtimetz.shouldBeAfter

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 test("test date") {2 val date = Instant.parse("2019-05-01T00:00:00Z")3 date shouldBe before(Instant.parse("2019-05-02T00:00:00Z"))4 }5 test("test date") {6 val date = LocalDate.parse("2019-05-01")7 date shouldBe before(LocalDate.parse("2019-05-02"))8 }9 test("test date") {10 val date = LocalDateTime.parse("2019-05-01T00:00:00")11 date shouldBe before(LocalDateTime.parse("2019-05-02T00:00:00"))12 }13 test("test date") {14 val date = LocalTime.parse("00:00:00")15 date shouldBe before(LocalTime.parse("00:00:01"))16 }17 test("test date") {18 val date = OffsetDateTime.parse("2019-05-01T00:00:00Z")19 date shouldBe before(OffsetDateTime.parse("2019-05-02T00:00:00Z"))20 }21 test("test date") {22 val date = ZonedDateTime.parse("2019-05-01T00:00:00Z")23 date shouldBe before(ZonedDateTime.parse("2019-05-02T00:00:00Z"))24 }25}26fun main() {27 testDate()28}29import io.kotest.matchers.date.*30import io.kotest.core.spec.style.*31import java.time.*32fun testDate() {33 test("test date") {34 val date = Instant.parse("2019-05-01T00:00:00Z")35 date shouldBe between(Instant.parse("2019-

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 "Instant should be in the past" {2 val instant = Instant.now()3 instant.shouldBeInThePast()4 }5 }6}7class LocalDateTest : FunSpec({8 test("LocalDate should be in the past") {9 val localDate = LocalDate.now()10 localDate.shouldBeInThePast()11 }12})13class LocalDateTimeTest : FunSpec({14 test("LocalDateTime should be in the past") {15 val localDateTime = LocalDateTime.now()16 localDateTime.shouldBeInThePast()17 }18})19class LocalTimeTest : FunSpec({20 test("LocalTime should be in the past") {21 val localTime = LocalTime.now()22 localTime.shouldBeInThePast()23 }24})25class MonthDayTest : FunSpec({26 test("MonthDay should be in the past") {27 val monthDay = MonthDay.now()28 monthDay.shouldBeInThePast()29 }30})31class OffsetDateTimeTest : FunSpec({32 test("OffsetDateTime should be in the past") {33 val offsetDateTime = OffsetDateTime.now()34 offsetDateTime.shouldBeInThePast()35 }36})37class OffsetTimeTest : FunSpec({38 test("OffsetTime should be in the past") {39 val offsetTime = OffsetTime.now()40 offsetTime.shouldBeInThePast()41 }42})43class YearTest : FunSpec({44 test("Year should be in the past") {45 val year = Year.now()46 year.shouldBeInThePast()47 }48})49class YearMonthTest : FunSpec({50 test("YearMonth should be in the past") {51 val yearMonth = YearMonth.now()52 yearMonth.shouldBeInThePast()53 }54})

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 fun `should return the current date and time`() {2 val now = Instant.now()3 now shouldBeInstantNow()4 }5 fun `should return the current date and time`() {6 val now = LocalDateTime.now()7 now shouldBeLocalDateTimeNow()8 }9 fun `should return the current date and time`() {10 val now = LocalDate.now()11 now shouldBeLocalDateNow()12 }13 fun `should return the current date and time`() {14 val now = LocalTime.now()15 now shouldBeLocalTimeNow()16 }17 fun `should return the current date and time`() {18 val now = OffsetDateTime.now()19 now shouldBeOffsetDateTimeNow()20 }21 fun `should return the current date and time`() {22 val now = OffsetTime.now()23 now shouldBeOffsetTimeNow()24 }25 fun `should return the current date and time`() {26 val now = ZonedDateTime.now()27 now shouldBeZonedDateTimeNow()28 }29 fun `should return the current date and time`() {30 val now = ZonedDateTime.now()31 now.zone shouldBeZonedIdNow()32 }33 fun `should return the current date and time`() {34 val now = ZonedDateTime.now()35 now.offset shouldBeZonedOffsetNow()36 }37 fun `should return the current date and time`() {

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1class DateTest : FunSpec({2 test("Date Test") {3 val date = Instant.now()4 date shouldBe Instant.now()5 }6})

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