How to use singleton class of io.kotest.matchers.collections package

Best Kotest code snippet using io.kotest.matchers.collections.singleton

BasicEventTest.kt

Source:BasicEventTest.kt Github

copy

Full Screen

1package dev.akkinoc.spring.boot.logback.access2import dev.akkinoc.spring.boot.logback.access.test.assertion.Assertions.assertLogbackAccessEventsEventually3import dev.akkinoc.spring.boot.logback.access.test.extension.EventsCapture4import dev.akkinoc.spring.boot.logback.access.test.extension.EventsCaptureExtension5import dev.akkinoc.spring.boot.logback.access.test.type.JettyReactiveWebTest6import dev.akkinoc.spring.boot.logback.access.test.type.JettyServletWebTest7import dev.akkinoc.spring.boot.logback.access.test.type.TomcatReactiveWebTest8import dev.akkinoc.spring.boot.logback.access.test.type.TomcatServletWebTest9import dev.akkinoc.spring.boot.logback.access.test.type.UndertowReactiveWebTest10import dev.akkinoc.spring.boot.logback.access.test.type.UndertowServletWebTest11import io.kotest.assertions.throwables.shouldThrowUnit12import io.kotest.matchers.booleans.shouldBeFalse13import io.kotest.matchers.booleans.shouldBeTrue14import io.kotest.matchers.collections.shouldBeSingleton15import io.kotest.matchers.collections.shouldContainAll16import io.kotest.matchers.collections.shouldContainExactly17import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder18import io.kotest.matchers.collections.shouldNotContainAnyOf19import io.kotest.matchers.longs.shouldBeBetween20import io.kotest.matchers.longs.shouldBeGreaterThanOrEqual21import io.kotest.matchers.longs.shouldBePositive22import io.kotest.matchers.longs.shouldBeZero23import io.kotest.matchers.maps.shouldBeEmpty24import io.kotest.matchers.nulls.shouldBeNull25import io.kotest.matchers.nulls.shouldNotBeNull26import io.kotest.matchers.shouldBe27import io.kotest.matchers.shouldNotBe28import io.kotest.matchers.string.shouldBeEmpty29import io.kotest.matchers.string.shouldNotBeEmpty30import io.kotest.matchers.string.shouldStartWith31import org.junit.jupiter.api.Test32import org.junit.jupiter.api.extension.ExtendWith33import org.springframework.beans.factory.annotation.Autowired34import org.springframework.boot.test.web.client.TestRestTemplate35import org.springframework.boot.test.web.client.exchange36import org.springframework.boot.web.server.LocalServerPort37import org.springframework.http.RequestEntity38import org.springframework.test.context.TestPropertySource39import java.lang.System.currentTimeMillis40import java.util.concurrent.TimeUnit.MILLISECONDS41/**42 * Tests the appended Logback-access event in the case where the configuration is the default.43 *44 * @property supportsRequestParametersByFormData Whether to support request parameters by form data.45 * @property supportsRequestAttributes Whether to support request attributes.46 * @property supportsSessionIDs Whether to support session IDs.47 * @property canForwardRequests Whether the web server can forward requests.48 */49@ExtendWith(EventsCaptureExtension::class)50@TestPropertySource(properties = ["logback.access.config=classpath:logback-access-test.capture.xml"])51sealed class BasicEventTest(52 private val supportsRequestParametersByFormData: Boolean,53 private val supportsRequestAttributes: Boolean,54 private val supportsSessionIDs: Boolean,55 private val canForwardRequests: Boolean,56) {57 @Test58 fun `Appends a Logback-access event`(59 @Autowired rest: TestRestTemplate,60 @LocalServerPort port: Int,61 capture: EventsCapture,62 ) {63 val request = RequestEntity.get("/mock-controller/text").build()64 val started = currentTimeMillis()65 val response = rest.exchange<String>(request)66 response.statusCodeValue.shouldBe(200)67 response.body.shouldBe("mock-text")68 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }69 val finished = currentTimeMillis()70 event.request.shouldBeNull()71 event.response.shouldBeNull()72 event.serverAdapter.shouldBeNull()73 event.timeStamp.shouldBeBetween(started, finished)74 event.elapsedTime.shouldBeBetween(0L, finished - started)75 event.elapsedSeconds.shouldBeBetween(0L, MILLISECONDS.toSeconds(finished - started))76 event.threadName.shouldNotBeEmpty()77 shouldThrowUnit<UnsupportedOperationException> { event.threadName = "changed-thread-name" }78 event.serverName.shouldBe("localhost")79 event.localPort.shouldBe(port)80 event.remoteAddr.shouldBe("127.0.0.1")81 event.remoteHost.shouldBe("127.0.0.1")82 event.remoteUser.shouldBe("-")83 event.protocol.shouldBe("HTTP/1.1")84 event.method.shouldBe("GET")85 event.requestURI.shouldBe("/mock-controller/text")86 event.queryString.shouldBeEmpty()87 event.requestURL.shouldBe("GET /mock-controller/text HTTP/1.1")88 event.requestHeaderMap.shouldNotBeNull()89 event.requestHeaderNames.shouldNotBeNull()90 event.getRequestHeader("x").shouldBe("-")91 event.getCookie("x").shouldBe("-")92 event.requestParameterMap.shouldBeEmpty()93 event.getRequestParameter("x").shouldContainExactly("-")94 event.getAttribute("x").shouldBe("-")95 event.sessionID.shouldBe("-")96 event.requestContent.shouldBeEmpty()97 event.statusCode.shouldBe(200)98 event.responseHeaderMap.shouldNotBeNull()99 event.responseHeaderNameList.shouldNotBeNull()100 event.getResponseHeader("x").shouldBe("-")101 event.contentLength.shouldBe(9L)102 event.responseContent.shouldBeEmpty()103 }104 @Test105 fun `Appends a Logback-access event with request headers`(106 @Autowired rest: TestRestTemplate,107 capture: EventsCapture,108 ) {109 val request = RequestEntity.get("/mock-controller/text")110 .header("a", "value @a")111 .header("b", "value1 @b", "value2 @b")112 .header("c", "")113 .build()114 val response = rest.exchange<String>(request)115 response.statusCodeValue.shouldBe(200)116 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }117 event.requestHeaderMap["a"].shouldBe("value @a")118 event.requestHeaderMap["b"].shouldBe("value1 @b")119 event.requestHeaderMap["c"].shouldBeEmpty()120 event.requestHeaderNames.toList().shouldContainAll("a", "b", "c")121 event.requestHeaderNames.toList().shouldNotContainAnyOf("A", "B", "C")122 event.getRequestHeader("a").shouldBe("value @a")123 event.getRequestHeader("A").shouldBe("value @a")124 event.getRequestHeader("b").shouldBe("value1 @b")125 event.getRequestHeader("B").shouldBe("value1 @b")126 event.getRequestHeader("c").shouldBeEmpty()127 event.getRequestHeader("C").shouldBeEmpty()128 }129 @Test130 fun `Appends a Logback-access event with request cookies`(131 @Autowired rest: TestRestTemplate,132 capture: EventsCapture,133 ) {134 val request = RequestEntity.get("/mock-controller/text")135 .header("cookie", "a=value+%40a; b=")136 .build()137 val response = rest.exchange<String>(request)138 response.statusCodeValue.shouldBe(200)139 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }140 event.getCookie("a").shouldBe("value+%40a")141 event.getCookie("b").shouldBeEmpty()142 }143 @Test144 fun `Appends a Logback-access event with request parameters by query string`(145 @Autowired rest: TestRestTemplate,146 capture: EventsCapture,147 ) {148 val request = RequestEntity.get("/mock-controller/text?a=value+@a&b=value1+@b&b=value2+@b&c=").build()149 val response = rest.exchange<String>(request)150 response.statusCodeValue.shouldBe(200)151 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }152 event.method.shouldBe("GET")153 event.requestURI.shouldBe("/mock-controller/text")154 event.queryString.shouldBe("?a=value+@a&b=value1+@b&b=value2+@b&c=")155 event.requestURL.shouldBe("GET /mock-controller/text?a=value+@a&b=value1+@b&b=value2+@b&c= HTTP/1.1")156 event.requestParameterMap.keys.shouldContainExactlyInAnyOrder("a", "b", "c")157 event.requestParameterMap["a"].shouldContainExactly("value @a")158 event.requestParameterMap["b"].shouldContainExactly("value1 @b", "value2 @b")159 event.requestParameterMap["c"].shouldContainExactly("")160 event.getRequestParameter("a").shouldContainExactly("value @a")161 event.getRequestParameter("b").shouldContainExactly("value1 @b", "value2 @b")162 event.getRequestParameter("c").shouldContainExactly("")163 }164 @Test165 fun `Appends a Logback-access event with request parameters by form data`(166 @Autowired rest: TestRestTemplate,167 capture: EventsCapture,168 ) {169 val request = RequestEntity.post("/mock-controller/form-data")170 .header("content-type", "application/x-www-form-urlencoded")171 .body("a=value+%40a&b=value1+%40b&b=value2+%40b&c=")172 val response = rest.exchange<String>(request)173 response.statusCodeValue.shouldBe(200)174 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }175 event.method.shouldBe("POST")176 event.requestURI.shouldBe("/mock-controller/form-data")177 event.queryString.shouldBeEmpty()178 event.requestURL.shouldBe("POST /mock-controller/form-data HTTP/1.1")179 if (supportsRequestParametersByFormData) {180 event.requestParameterMap.keys.shouldContainExactlyInAnyOrder("a", "b", "c")181 event.requestParameterMap["a"].shouldContainExactly("value @a")182 event.requestParameterMap["b"].shouldContainExactly("value1 @b", "value2 @b")183 event.requestParameterMap["c"].shouldContainExactly("")184 event.getRequestParameter("a").shouldContainExactly("value @a")185 event.getRequestParameter("b").shouldContainExactly("value1 @b", "value2 @b")186 event.getRequestParameter("c").shouldContainExactly("")187 } else {188 event.requestParameterMap.shouldBeEmpty()189 event.getRequestParameter("a").shouldContainExactly("-")190 event.getRequestParameter("b").shouldContainExactly("-")191 event.getRequestParameter("c").shouldContainExactly("-")192 }193 }194 @Test195 fun `Appends a Logback-access event with request attributes`(196 @Autowired rest: TestRestTemplate,197 capture: EventsCapture,198 ) {199 val request = RequestEntity.get("/mock-controller/text-with-request-attributes").build()200 val response = rest.exchange<String>(request)201 response.statusCodeValue.shouldBe(200)202 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }203 if (supportsRequestAttributes) {204 event.getAttribute("a").shouldBe("value @a")205 event.getAttribute("b").shouldBe("[value1 @b, value2 @b]")206 event.getAttribute("c").shouldBe("")207 event.getAttribute("d").shouldStartWith("java.lang.Object@")208 } else {209 event.getAttribute("a").shouldBe("-")210 event.getAttribute("b").shouldBe("-")211 event.getAttribute("c").shouldBe("-")212 event.getAttribute("d").shouldBe("-")213 }214 }215 @Test216 fun `Appends a Logback-access event with a session`(217 @Autowired rest: TestRestTemplate,218 capture: EventsCapture,219 ) {220 val request = RequestEntity.get("/mock-controller/text-with-session").build()221 val response = rest.exchange<String>(request)222 response.statusCodeValue.shouldBe(200)223 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }224 if (supportsSessionIDs) event.sessionID.shouldNotBeEmpty().shouldNotBe("-")225 else event.sessionID.shouldBe("-")226 }227 @Test228 fun `Appends a Logback-access event with response headers`(229 @Autowired rest: TestRestTemplate,230 capture: EventsCapture,231 ) {232 val request = RequestEntity.get("/mock-controller/text-with-response-headers").build()233 val response = rest.exchange<String>(request)234 response.statusCodeValue.shouldBe(200)235 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }236 event.responseHeaderMap["a"].shouldBe("value @a")237 event.responseHeaderMap["b"].shouldBe("value1 @b")238 event.responseHeaderMap["c"].shouldBeEmpty()239 event.responseHeaderNameList.shouldContainAll("a", "b", "c")240 event.responseHeaderNameList.shouldNotContainAnyOf("A", "B", "C")241 event.getResponseHeader("a").shouldBe("value @a")242 event.getResponseHeader("A").shouldBe("value @a")243 event.getResponseHeader("b").shouldBe("value1 @b")244 event.getResponseHeader("B").shouldBe("value1 @b")245 event.getResponseHeader("c").shouldBeEmpty()246 event.getResponseHeader("C").shouldBeEmpty()247 }248 @Test249 fun `Appends a Logback-access event with an empty response`(250 @Autowired rest: TestRestTemplate,251 capture: EventsCapture,252 ) {253 val request = RequestEntity.get("/mock-controller/empty-text").build()254 val response = rest.exchange<String>(request)255 response.statusCodeValue.shouldBe(200)256 response.hasBody().shouldBeFalse()257 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }258 event.contentLength.shouldBeZero()259 }260 @Test261 fun `Appends a Logback-access event with an asynchronous response`(262 @Autowired rest: TestRestTemplate,263 capture: EventsCapture,264 ) {265 val request = RequestEntity.get("/mock-controller/text-asynchronously").build()266 val response = rest.exchange<String>(request)267 response.statusCodeValue.shouldBe(200)268 response.body.shouldBe("mock-text")269 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }270 event.threadName.shouldNotBeEmpty()271 event.contentLength.shouldBe(9L)272 }273 @Test274 fun `Appends a Logback-access event with a chunked response`(275 @Autowired rest: TestRestTemplate,276 capture: EventsCapture,277 ) {278 val request = RequestEntity.get("/mock-controller/text-with-chunked-transfer-encoding").build()279 val response = rest.exchange<String>(request)280 response.statusCodeValue.shouldBe(200)281 response.headers["transfer-encoding"].shouldBe(listOf("chunked"))282 response.headers["content-length"].shouldBeNull()283 response.body.shouldBe("mock-text")284 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }285 event.contentLength.shouldBeGreaterThanOrEqual(9L)286 }287 @Test288 fun `Appends a Logback-access event with a forward response`(289 @Autowired rest: TestRestTemplate,290 capture: EventsCapture,291 ) {292 if (!canForwardRequests) return293 val request = RequestEntity.get("/mock-controller/text-with-forward?a=value+@a").build()294 val response = rest.exchange<String>(request)295 response.statusCodeValue.shouldBe(200)296 response.body.shouldBe("mock-text")297 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }298 event.protocol.shouldBe("HTTP/1.1")299 event.method.shouldBe("GET")300 event.requestURI.shouldBe("/mock-controller/text-with-forward")301 event.queryString.shouldBe("?a=value+@a")302 event.requestURL.shouldBe("GET /mock-controller/text-with-forward?a=value+@a HTTP/1.1")303 event.statusCode.shouldBe(200)304 event.contentLength.shouldBe(9L)305 }306 @Test307 fun `Appends a Logback-access event with an error response`(308 @Autowired rest: TestRestTemplate,309 capture: EventsCapture,310 ) {311 val request = RequestEntity.get("/mock-controller/unknown?a=value+@a").build()312 val response = rest.exchange<String>(request)313 response.statusCodeValue.shouldBe(404)314 response.hasBody().shouldBeTrue()315 val event = assertLogbackAccessEventsEventually { capture.shouldBeSingleton().single() }316 event.protocol.shouldBe("HTTP/1.1")317 event.method.shouldBe("GET")318 event.requestURI.shouldBe("/mock-controller/unknown")319 event.queryString.shouldBe("?a=value+@a")320 event.requestURL.shouldBe("GET /mock-controller/unknown?a=value+@a HTTP/1.1")321 event.statusCode.shouldBe(404)322 event.contentLength.shouldBePositive()323 }324}325/**326 * Tests the [BasicEventTest] using the Tomcat servlet web server.327 */328@TomcatServletWebTest329class TomcatServletWebBasicEventTest : BasicEventTest(330 supportsRequestParametersByFormData = true,331 supportsRequestAttributes = true,332 supportsSessionIDs = true,333 canForwardRequests = true,334)335/**336 * Tests the [BasicEventTest] using the Tomcat reactive web server.337 */338@TomcatReactiveWebTest339class TomcatReactiveWebBasicEventTest : BasicEventTest(340 supportsRequestParametersByFormData = false,341 supportsRequestAttributes = false,342 supportsSessionIDs = false,343 canForwardRequests = false,344)345/**346 * Tests the [BasicEventTest] using the Jetty servlet web server.347 */348@JettyServletWebTest349class JettyServletWebBasicEventTest : BasicEventTest(350 supportsRequestParametersByFormData = true,351 supportsRequestAttributes = true,352 supportsSessionIDs = true,353 canForwardRequests = true,354)355/**356 * Tests the [BasicEventTest] using the Jetty reactive web server.357 */358@JettyReactiveWebTest359class JettyReactiveWebBasicEventTest : BasicEventTest(360 supportsRequestParametersByFormData = false,361 supportsRequestAttributes = false,362 supportsSessionIDs = false,363 canForwardRequests = false,364)365/**366 * Tests the [BasicEventTest] using the Undertow servlet web server.367 */368@UndertowServletWebTest369class UndertowServletWebBasicEventTest : BasicEventTest(370 supportsRequestParametersByFormData = true,371 supportsRequestAttributes = true,372 supportsSessionIDs = true,373 canForwardRequests = true,374)375/**376 * Tests the [BasicEventTest] using the Undertow reactive web server.377 */378@UndertowReactiveWebTest379class UndertowReactiveWebBasicEventTest : BasicEventTest(380 supportsRequestParametersByFormData = false,381 supportsRequestAttributes = false,382 supportsSessionIDs = false,383 canForwardRequests = false,384)...

Full Screen

Full Screen

matchers.kt

Source:matchers.kt Github

copy

Full Screen

1package tutorial.kotest2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.assertions.throwables.shouldThrowAny4import io.kotest.assertions.throwables.shouldThrowExactly5import io.kotest.core.spec.style.DescribeSpec6import io.kotest.core.test.AssertionMode7import io.kotest.matchers.booleans.shouldBeTrue8import io.kotest.matchers.collections.shouldBeIn9import io.kotest.matchers.collections.shouldBeOneOf10import io.kotest.matchers.collections.shouldBeSameSizeAs11import io.kotest.matchers.collections.shouldBeSingleton12import io.kotest.matchers.collections.shouldBeSmallerThan13import io.kotest.matchers.collections.shouldBeSorted14import io.kotest.matchers.collections.shouldBeUnique15import io.kotest.matchers.collections.shouldContain16import io.kotest.matchers.collections.shouldContainAll17import io.kotest.matchers.collections.shouldContainAnyOf18import io.kotest.matchers.collections.shouldContainDuplicates19import io.kotest.matchers.collections.shouldContainExactly20import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder21import io.kotest.matchers.collections.shouldContainInOrder22import io.kotest.matchers.collections.shouldContainNull23import io.kotest.matchers.collections.shouldEndWith24import io.kotest.matchers.collections.shouldHaveAtLeastSize25import io.kotest.matchers.collections.shouldHaveLowerBound26import io.kotest.matchers.collections.shouldHaveSingleElement27import io.kotest.matchers.collections.shouldHaveSize28import io.kotest.matchers.collections.shouldHaveUpperBound29import io.kotest.matchers.collections.shouldNotContainAnyOf30import io.kotest.matchers.collections.shouldNotHaveElementAt31import io.kotest.matchers.collections.shouldStartWith32import io.kotest.matchers.comparables.shouldBeEqualComparingTo33import io.kotest.matchers.comparables.shouldBeLessThanOrEqualTo34import io.kotest.matchers.date.shouldBeToday35import io.kotest.matchers.date.shouldHaveSameHoursAs36import io.kotest.matchers.doubles.Percentage37import io.kotest.matchers.doubles.beNaN38import io.kotest.matchers.doubles.plusOrMinus39import io.kotest.matchers.doubles.shouldBeNaN40import io.kotest.matchers.doubles.shouldNotBeNaN41import io.kotest.matchers.equality.shouldBeEqualToComparingFields42import io.kotest.matchers.equality.shouldBeEqualToComparingFieldsExcept43import io.kotest.matchers.equality.shouldBeEqualToIgnoringFields44import io.kotest.matchers.equality.shouldBeEqualToUsingFields45import io.kotest.matchers.file.shouldBeADirectory46import io.kotest.matchers.file.shouldBeAbsolute47import io.kotest.matchers.file.shouldExist48import io.kotest.matchers.file.shouldNotBeEmpty49import io.kotest.matchers.ints.beOdd50import io.kotest.matchers.ints.shouldBeBetween51import io.kotest.matchers.ints.shouldBeInRange52import io.kotest.matchers.ints.shouldBeLessThan53import io.kotest.matchers.ints.shouldBeLessThanOrEqual54import io.kotest.matchers.ints.shouldBeOdd55import io.kotest.matchers.ints.shouldBePositive56import io.kotest.matchers.ints.shouldBeZero57import io.kotest.matchers.iterator.shouldBeEmpty58import io.kotest.matchers.iterator.shouldHaveNext59import io.kotest.matchers.maps.shouldBeEmpty60import io.kotest.matchers.maps.shouldContain61import io.kotest.matchers.maps.shouldContainAll62import io.kotest.matchers.maps.shouldContainExactly63import io.kotest.matchers.maps.shouldContainKey64import io.kotest.matchers.nulls.shouldBeNull65import io.kotest.matchers.nulls.shouldNotBeNull66import io.kotest.matchers.shouldBe67import io.kotest.matchers.shouldNot68import io.kotest.matchers.shouldNotBe69import io.kotest.matchers.string.beEmpty70import io.kotest.matchers.string.shouldBeBlank71import io.kotest.matchers.string.shouldBeEmpty72import io.kotest.matchers.string.shouldBeEqualIgnoringCase73import io.kotest.matchers.string.shouldBeInteger74import io.kotest.matchers.string.shouldBeLowerCase75import io.kotest.matchers.string.shouldBeUpperCase76import io.kotest.matchers.string.shouldContain77import io.kotest.matchers.string.shouldContainADigit78import io.kotest.matchers.string.shouldContainIgnoringCase79import io.kotest.matchers.string.shouldContainOnlyDigits80import io.kotest.matchers.string.shouldContainOnlyOnce81import io.kotest.matchers.string.shouldEndWith82import io.kotest.matchers.string.shouldHaveLength83import io.kotest.matchers.string.shouldHaveLineCount84import io.kotest.matchers.string.shouldHaveMaxLength85import io.kotest.matchers.string.shouldHaveMinLength86import io.kotest.matchers.string.shouldHaveSameLengthAs87import io.kotest.matchers.string.shouldMatch88import io.kotest.matchers.string.shouldNotBeEmpty89import io.kotest.matchers.string.shouldStartWith90import io.kotest.matchers.throwable.shouldHaveCause91import io.kotest.matchers.throwable.shouldHaveCauseInstanceOf92import io.kotest.matchers.throwable.shouldHaveCauseOfType93import io.kotest.matchers.throwable.shouldHaveMessage94import io.kotest.matchers.types.shouldBeInstanceOf95import io.kotest.matchers.types.shouldBeSameInstanceAs96import io.kotest.matchers.types.shouldBeTypeOf97import io.kotest.matchers.uri.shouldHaveHost98import io.kotest.matchers.uri.shouldHavePort99import io.kotest.matchers.uri.shouldHaveScheme100import java.io.File101import java.net.URI102import java.time.LocalDate103import java.time.LocalTime104// https://kotest.io/docs/assertions/core-matchers.html105class MatchersTest : DescribeSpec({106 describe("general") {107 it("basics") {108 (1 == 1).shouldBeTrue()109 (2 + 2) shouldBe 4110 val foo: Any = "foobar"111 foo.shouldBeTypeOf<String>() shouldContain "fo"112 "".shouldBeEmpty()113 "x".shouldNot(beEmpty()) // manually negate114 "x".shouldNotBeEmpty() // reusable115 URI("https://tba") shouldHaveHost "tba"116 URI("https://tba:81") shouldHavePort 81117 URI("https://tba") shouldHaveScheme "https"118 File("/").apply {119 shouldExist()120 shouldBeADirectory()121 shouldBeAbsolute()122 shouldNotBeEmpty()123 }124 // executable, hidden, readable, smaller, writeable, containFile, extension, path, ...125 LocalDate.now().shouldBeToday()126 // before/after, within, same, between, have year/month/day/hour/...127 LocalTime.now().shouldHaveSameHoursAs(LocalTime.now())128 // before/after/between, sameMinute/Seconds/Nanos129 }130 it("numbers") {131 1 shouldBeLessThan 2132 1 shouldBeLessThanOrEqual 1 // Int-based; returns this133 1 shouldBeLessThanOrEqualTo 1 // Comparble-based; void134 1 shouldBeEqualComparingTo 1 // Comparable-based135 1.shouldBeBetween(0, 2)136 1 shouldBeInRange 0..2137 0.shouldBeZero()138 1.shouldBePositive()139 1.shouldBeOdd()140 (1.2).shouldBe(1.20001.plusOrMinus(Percentage(20.0)))141 (1.2).shouldNotBeNaN()142 }143 it("strings") {144 // generic: "abc" shouldBe "abc"145 "aBc" shouldBeEqualIgnoringCase "abc"146 "".shouldBeEmpty()147 " ".shouldBeBlank() // empty or whitespace148 "abc" shouldContain ("b")149 "aBc" shouldContainIgnoringCase "bc"150 "x-a-x" shouldContain """\-[a-z]\-""".toRegex()151 "-a-" shouldMatch """\-[a-z]\-""".toRegex()152 "abc" shouldStartWith ("a")153 "abc" shouldEndWith ("c")154 "ab aa" shouldContainOnlyOnce "aa"155 "abc".shouldBeLowerCase()156 "ABC".shouldBeUpperCase()157 "abc" shouldHaveLength 3158 "a\nb" shouldHaveLineCount 2159 "ab" shouldHaveMinLength 1 shouldHaveMaxLength 3160 "abc" shouldHaveSameLengthAs "foo"161 "1".shouldBeInteger()162 "12".shouldContainOnlyDigits()163 "abc1".shouldContainADigit() // at least one164 }165 it("types") {166 @Connotation167 open class SuperType()168 class SubType : SuperType()169 val sameRef = SuperType()170 sameRef.shouldBeSameInstanceAs(sameRef)171 val superType: SuperType = SubType()172 superType.shouldBeTypeOf<SubType>() // exact runtime match (SuperType won't work!)173 superType.shouldBeInstanceOf<SuperType>() // T or below174// SubType().shouldHaveAnnotation(Connotation::class)175 val nullable: String? = null176 nullable.shouldBeNull()177 }178 it("collections") {179 emptyList<Int>().iterator().shouldBeEmpty()180 listOf(1).iterator().shouldHaveNext()181 listOf(1, 2) shouldContain 1 // at least182 listOf(1, 2) shouldContainExactly listOf(1, 2) // in-order; not more183 listOf(1, 2) shouldContainExactlyInAnyOrder listOf(2, 1) // out-order; not more184 listOf(0, 3, 0, 4, 0).shouldContainInOrder(3, 4) // possible items in between185 listOf(1) shouldNotContainAnyOf listOf(2, 3) // black list186 listOf(1, 2, 3) shouldContainAll listOf(3, 2) // out-order; more187 listOf(1, 2, 3).shouldBeUnique() // no duplicates188 listOf(1, 2, 2).shouldContainDuplicates() // at least one duplicate189 listOf(1, 2).shouldNotHaveElementAt(1, 3)190 listOf(1, 2) shouldStartWith 1191 listOf(1, 2) shouldEndWith 2192 listOf(1, 2) shouldContainAnyOf listOf(2, 3)193 val x = SomeType(1)194 x shouldBeOneOf listOf(x) // by reference/instance195 x shouldBeIn listOf(SomeType(1)) // by equality/structural196 listOf(1, 2, null).shouldContainNull()197 listOf(1) shouldHaveSize 1198 listOf(1).shouldBeSingleton() // size == 1199 listOf(1).shouldBeSingleton {200 it.shouldBeOdd()201 }202 listOf(1).shouldHaveSingleElement {203 beOdd().test(it).passed() // have to return a boolean here :-/204 }205 listOf(2, 3) shouldHaveLowerBound 1 shouldHaveUpperBound 4206 listOf(1) shouldBeSmallerThan listOf(1, 2)207 listOf(1) shouldBeSameSizeAs listOf(2)208 listOf(1, 2) shouldHaveAtLeastSize 1209 listOf(1, 2).shouldBeSorted()210 mapOf(1 to "a").shouldContain(1, "a") // at least this211 mapOf(1 to "a") shouldContainAll mapOf(1 to "a") // at least those212 mapOf(1 to "a") shouldContainExactly mapOf(1 to "a") // not more213 mapOf(1 to "a") shouldContainKey 1214 emptyMap<Any, Any>().shouldBeEmpty()215 }216 it("exceptions") {217 class SubException() : Exception()218 Exception("a") shouldHaveMessage "a" // same (not contains!)219 Exception("abc").message shouldContain "b"220 Exception("", Exception()).shouldHaveCause()221 Exception("symptom", Exception("cause")).shouldHaveCause {222 it.message shouldBe "cause"223 }224 Exception("", SubException()).shouldHaveCauseInstanceOf<Exception>() // T or subclass225 Exception("", SubException()).shouldHaveCauseOfType<SubException>() // exactly T226 shouldThrow<Exception> { // type or subtype227 throw SubException()228 }229 shouldThrowExactly<Exception> { // exactly that type (no subtype!)230 throw Exception()231 }232 shouldThrowAny { // don't care which233 throw Exception()234 }235 }236 }237 describe("advanced") {238 it("selective matcheres") {239 data class Foo(val p1: Int, val p2: Int)240 val foo1 = Foo(1, 1)241 val foo2 = Foo(1, 2)242 foo1.shouldBeEqualToUsingFields(foo2, Foo::p1)243 foo1.shouldBeEqualToIgnoringFields(foo2, Foo::p2)244 class Bar(val p1: Int, val p2: Int) // not a data class! no equals.245 val bar1a = Bar(1, 1)246 val bar1b = Bar(1, 1)247 bar1a shouldNotBe bar1b248 bar1a shouldBeEqualToComparingFields bar1b // "fake equals" (ignoring private properties)249 bar1a.shouldBeEqualToComparingFields(bar1b, false) // explicitly also check private props250 val bar2 = Bar(1, 2)251 bar1a.shouldBeEqualToComparingFieldsExcept(bar2, Bar::p2)252 }253 }254 // channels255 // concurrent, futures256 // result, optional257 // threads258 // reflection259 // statistic, regex260})261private data class SomeType(val value: Int = 1)262private annotation class Connotation...

Full Screen

Full Screen

IteratorUtilsTests.kt

Source:IteratorUtilsTests.kt Github

copy

Full Screen

...42 exception shouldHaveMessage "Can't iterate over an empty iterator"43 }44 }45 context("Invoking iteratorOf(item)") {46 should("return a singleton iterator") {47 val item = Unit48 val iterator = iteratorOf(item)49 iterator.shouldHaveNext()50 iterator.next() shouldBe item51 iterator.shouldNotHaveNext()52 // the 'NoSuchElementException' is defined by the underlying 'AbstractIterator' and may change at some53 // point, but that should be unlikely.54 shouldThrow<NoSuchElementException> { iterator.next() }55 }56 }57 context("Invoking iteratorOf(...items)") {58 should("return an iterator for the items") {59 val itemOne = 160 val itemTwo = 2...

Full Screen

Full Screen

SybonCheckingApiTests.kt

Source:SybonCheckingApiTests.kt Github

copy

Full Screen

1package sybon2import io.kotest.core.spec.style.StringSpec3import io.kotest.koin.KoinListener4import io.kotest.matchers.collections.shouldBeSingleton5import io.kotest.matchers.collections.shouldContainAll6import io.kotest.matchers.collections.shouldHaveSize7import io.kotest.matchers.shouldBe8import kotlinx.serialization.encodeToString9import kotlinx.serialization.json.Json10import org.koin.java.KoinJavaComponent.inject11import org.koin.test.KoinTest12import sybon.api.SybonCheckingApi13import sybon.api.SybonSubmissionResult14import sybon.api.SybonSubmissionResult.BuildResult15import sybon.api.SybonSubmissionResult.TestGroupResult16import sybon.api.SybonSubmissionResult.TestGroupResult.TestResult17import sybon.api.SybonSubmissionResult.TestGroupResult.TestResult.ResourceUsage18import sybon.api.SybonSubmitSolution19import sybonModule20import util.encodeBase6421class SybonCheckingApiTests :22 StringSpec({23 val api by inject(SybonCheckingApi::class.java)24 "getCompilers should return all known compilers" {25 val compilers = api.getCompilers()26 compilers shouldContainAll SybonCompilers.list27 }28 "submitSolution should submit a correct solution and receive submission id" {29 val submissionId = api.submitSolution(30 SybonSubmitSolution(31 SybonCompilers.CPP.id,32 A_PLUS_B_PROBLEM_ID,33 OK_CPP_SOLUTION34 )35 )36 println(submissionId)37 }38 "getResults should return correct result for accepted C++ submission" {39 val submissionId = 46699440 val expectedSubmissionResult = SybonSubmissionResult(41 id = submissionId,42 buildResult = BuildResult(status = BuildResult.Status.OK, output = ""),43 testGroupResults = emptyList()44 )45 val expectedFirstTestGroupResult = TestGroupResult(46 internalId = "",47 executed = true,48 testResults = emptyList()49 )50 val expectedFirstTestResult = TestResult(51 status = TestResult.Status.OK,52 judgeMessage = "",53 resourceUsage = ResourceUsage(timeUsageMillis = 1, memoryUsageBytes = 385024)54 )55 val submissionResults = api.getResults("$submissionId")56 submissionResults.shouldBeSingleton()57 val submissionResult = submissionResults.single()58 submissionResult.copy(testGroupResults = emptyList()) shouldBe expectedSubmissionResult59 submissionResult.testGroupResults shouldHaveSize 160 val testResults = submissionResult.testGroupResults.single()61 testResults.copy(testResults = emptyList()) shouldBe expectedFirstTestGroupResult62 testResults.testResults shouldHaveSize 1063 testResults.testResults.first() shouldBe expectedFirstTestResult64 }65 "getResults with two ids should return sorted by id results" {66 val ids = listOf(467018, 467020, 467019)67 val s = ids.joinToString(",")68 api.getResults(s).map { it.id } shouldBe ids.sorted()69 }70 "Test getResults test groups results for accepted C++ solution" {71 val submissionId = 46699472 val result = api.getResults(submissionId.toString()).single()73 println(Json { prettyPrint = true }.encodeToString(result))74 }75 }),76 KoinTest {77 companion object {78 const val A_PLUS_B_PROBLEM_ID = 871679 @Suppress("SpellCheckingInspection")80 val OK_CPP_SOLUTION = """81 #include <iostream>82 int main() {83 long long x, y;84 std::cin >> x >> y;85 std::cout << x + y;86 return 0;87 }88 """.trimIndent().encodeBase64()89 }90 override fun listeners() = listOf(KoinListener(sybonModule))91}...

Full Screen

Full Screen

StoreRepositoryTest.kt

Source:StoreRepositoryTest.kt Github

copy

Full Screen

1package kr.bistroad.storeservice.store.infrastructure2import io.kotest.matchers.collections.shouldBeEmpty3import io.kotest.matchers.collections.shouldBeSingleton4import io.kotest.matchers.comparables.shouldBeLessThan5import io.kotest.matchers.nulls.shouldBeNull6import io.kotest.matchers.nulls.shouldNotBeNull7import io.kotest.matchers.shouldBe8import kr.bistroad.storeservice.global.domain.Coordinate9import kr.bistroad.storeservice.store.domain.Owner10import kr.bistroad.storeservice.store.domain.Store11import org.junit.jupiter.api.AfterEach12import org.junit.jupiter.api.Test13import org.springframework.beans.factory.annotation.Autowired14import org.springframework.boot.test.context.SpringBootTest15import org.springframework.data.domain.Pageable16import org.springframework.data.geo.Metrics17import org.springframework.data.repository.findByIdOrNull18import java.util.*19@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)20internal class StoreRepositoryTest {21 @Autowired22 private lateinit var storeRepository: StoreRepository23 @AfterEach24 fun clear() = storeRepository.deleteAll()25 @Test26 fun `Searches stores nearby`() {27 val store = Store(28 owner = Owner(UUID.randomUUID()),29 name = "A store",30 phone = "02-123-4567",31 description = "The best store ever",32 address = "Seoul",33 location = Coordinate(0.1, 0.1)34 )35 storeRepository.save(store)36 val foundStore = storeRepository.findByIdOrNull(store.id)37 foundStore.shouldNotBeNull()38 foundStore.shouldBe(store)39 }40 @Test41 fun `Finds stores`() {42 val storeA = Store(43 owner = Owner(UUID.randomUUID()),44 name = "", phone = "", description = "", address = "",45 location = Coordinate(37.61976485, 127.05975656)46 )47 val storeB = Store(48 owner = Owner(UUID.randomUUID()),49 name = "", phone = "", description = "", address = "",50 location = Coordinate(37.61978087, 127.0608598)51 )52 val storeC = Store(53 owner = Owner(UUID.randomUUID()),54 name = "", phone = "", description = "", address = "",55 location = Coordinate(37.61987435, 127.05740511)56 )57 storeRepository.save(storeA)58 storeRepository.save(storeB)59 storeRepository.save(storeC)60 val foundStores = storeRepository.searchNearby(61 origin = Coordinate(37.61960241, 127.05948651),62 distance = 100.0,63 pageable = Pageable.unpaged()64 )65 foundStores.shouldBeSingleton()66 with(foundStores.first()) {67 this.content.shouldBe(storeA)68 this.distance.`in`(Metrics.KILOMETERS).value.times(1000).shouldBeLessThan(100.0)69 }70 }71 @Test72 fun `Deletes a store`() {73 val store = Store(74 owner = Owner(UUID.randomUUID()),75 name = "A store",76 phone = "02-123-4567",77 description = "The best store ever",78 address = "Seoul",79 location = Coordinate(0.1, 0.1)80 )81 storeRepository.save(store)82 val storeId = store.id83 storeRepository.deleteById(storeId)84 storeRepository.findByIdOrNull(storeId).shouldBeNull()85 storeRepository.findAll().shouldBeEmpty()86 }87}...

Full Screen

Full Screen

AuctionRepositoryAdapterTest.kt

Source:AuctionRepositoryAdapterTest.kt Github

copy

Full Screen

1package com.github.christophpickl.tbakotlinmasterproject.boundary.boundarydb2import arrow.core.left3import arrow.core.right4import com.github.christophpickl.tbakotlinmasterproject.commons.commonslang.forced5import com.github.christophpickl.tbakotlinmasterproject.domain.domainmodel.Auction6import com.github.christophpickl.tbakotlinmasterproject.domain.domainmodel.AuctionId7import com.github.christophpickl.tbakotlinmasterproject.domain.domainmodel.Fault8import com.github.christophpickl.tbakotlinmasterproject.domain.domainmodel.Title9import com.github.christophpickl.tbakotlinmasterproject.domain.domainmodel.any10import io.kotest.assertions.arrow.core.shouldBeLeft11import io.kotest.assertions.arrow.core.shouldBeRight12import io.kotest.core.spec.style.DescribeSpec13import io.kotest.core.test.TestCase14import io.kotest.matchers.collections.shouldBeSingleton15import io.kotest.matchers.shouldBe16import io.kotest.matchers.types.shouldBeSameInstanceAs17import io.mockk.every18import io.mockk.mockk19import io.mockk.verify20import org.jetbrains.exposed.sql.Database21internal class AuctionRepositoryAdapterTest : DescribeSpec() {22 private val fault = Fault.any()23 private val auction = Auction.any()24 private val auctionDbo = AuctionDbo.any()25 private lateinit var exposed: AuctionRepositoryExposed26 private lateinit var database: Database27 private lateinit var adapter: AuctionRepositoryAdapter28 override fun beforeTest(testCase: TestCase) {29 exposed = mockk()30 database = mockk()31 adapter = AuctionRepositoryAdapter(exposed, database)32 }33 init {34 describe("When loadAll") {35 it("Given right exposed repo Then transform and return") {36 every { exposed.selectAll(any()) } returns listOf(auctionDbo).right()37 val result = adapter.loadAll()38 result.shouldBeRight().shouldBeSingleton().first() shouldBe Auction(39 id = AuctionId(value = auctionDbo.id),40 title = Title(value = auctionDbo.title).forced()41 )42 }43 it("Given faulty exposed repo Then also fail") {44 every { exposed.selectAll(any()) } returns fault.left()45 val result = adapter.loadAll()46 result.shouldBeLeft() shouldBeSameInstanceAs fault47 }48 }49 describe("When insert") {50 it("Given right exposed repo Then inserted") {51 every { exposed.insert(any(), any()) } returns Unit.right()52 val result = adapter.insert(auction)53 result.shouldBeRight()54 verify { exposed.insert(database, auction.toAuctionDbo()) }55 }56 it("Given faulty exposed repo Then also fail") {57 every { exposed.insert(any(), any()) } returns fault.left()58 val result = adapter.insert(Auction.any())59 result.shouldBeLeft() shouldBeSameInstanceAs fault60 }61 }62 }63 private fun Auction.toAuctionDbo() = AuctionDbo(64 id = id.value,65 title = title.value66 )67}...

Full Screen

Full Screen

SimpleTests.kt

Source:SimpleTests.kt Github

copy

Full Screen

1package me.bristermitten.frigga2import io.kotest.matchers.collections.shouldBeEmpty3import io.kotest.matchers.collections.shouldBeSingleton4import io.kotest.matchers.collections.shouldContain5import io.kotest.matchers.shouldBe6import me.bristermitten.frigga.runtime.data.decValue7import me.bristermitten.frigga.runtime.data.intValue8import org.junit.jupiter.api.Test9class SimpleTests : FriggaTest()10{11 @Test12 fun `Test Simple Property Declaration`()13 {14 val code = """15 x = 316 x17 """.trimIndent()18 val result = runtime.execute(code)19 result.leftoverStack shouldContain intValue(3)20 result.leftoverStack.shouldBeSingleton()21 }22 @Test23 fun `Test Simple Property With Explicit Type`()24 {25 val code = """26 x::Int = 327 x28 29 """.trimIndent()30 val result = runtime.execute(code)31 result.leftoverStack shouldContain intValue(3)32 result.leftoverStack.shouldBeSingleton()33 }34 @Test35 fun `Test Immutable Property Redefinition throws Exception`()36 {37 val code = """38 x = 339 x = 440 x41 """.trimIndent()42 val result = runtime.execute(code)43 result.exceptions.shouldBeSingleton()44 result.leftoverStack.shouldBeEmpty()45 }46 @Test47 fun `Test Mutable Property Redefinition does not throw Exception`()48 {49 val code = """50 mutable x = 351 x = 452 """.trimIndent()53 val result = runtime.execute(code)54 result.exceptions.shouldBeEmpty()55 result.leftoverStack.shouldBeEmpty()56 }57 @Test58 fun `Test Property Definition and reassignment with different types`()59 {60 val code = """61 mutable x = 3.062 x = 463 x + 164 """.trimIndent()65 val result = runtime.execute(code)66 handleExceptions(result)67 result.leftoverStack.shouldBeSingleton()68 result.leftoverStack.first() shouldBe decValue(5.0)69 }70 @Test71 fun `Test Property Definition and reassignment adding 1`()72 {73 val code = """74 mutable x = 375 x = x + 176 x77 """.trimIndent()78 val result = runtime.execute(code)79 handleExceptions(result)80 result.leftoverStack.first() shouldBe intValue(4)81 }82 @Test83 fun `Test Property Definition and reassignment adding 1 twice`()84 {85 val code = """86 mutable x = 387 x = x + 188 x = x + 189 x90 """.trimIndent()91 val result = runtime.execute(code)92 handleExceptions(result)93 result.leftoverStack.first() shouldBe intValue(5)94 }95}...

Full Screen

Full Screen

PoetimizelyPluginTest.kt

Source:PoetimizelyPluginTest.kt Github

copy

Full Screen

1package com.patxi.poetimizely.gradle.plugin2import io.kotest.core.spec.style.BehaviorSpec3import io.kotest.matchers.collections.shouldBeSingleton4import io.kotest.matchers.shouldNotBe5import io.kotest.matchers.types.shouldBeInstanceOf6import org.gradle.testfixtures.ProjectBuilder7class PoetimizelyPluginTest : BehaviorSpec({8 given("A Gradle project") {9 val project = ProjectBuilder.builder().build()10 `when`("Poetimizely plugin is applied") {11 project.pluginManager.apply("com.patxi.poetimizely")12 then("Plugin is contained") {13 project.plugins.getPlugin(PoetimizelyPlugin::class.java) shouldNotBe null14 }15 then("Extension is contained") {16 project.extensions.getByName("poetimizely").shouldBeInstanceOf<PoetimizelyExtension>()17 }18 then("Task is contained") {19 val generatorTask = project.getTasksByName("poetimize", false)20 generatorTask.shouldBeSingleton()21 generatorTask.first().shouldBeInstanceOf<GeneratorTask>()22 }23 }24 }25})...

Full Screen

Full Screen

singleton

Using AI Code Generation

copy

Full Screen

1 import io.kotest.matchers.collections.shouldContain2 import io.kotest.matchers.collections.shouldContainAll3 import io.kotest.matchers.collections.shouldContainNone4 import io.kotest.matchers.collections.shouldContainExactly5 import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder6 import io.kotest.matchers.collections.shouldContainExactlyInAnyOrderOnly7 import io.kotest.matchers.collections.shouldContainExactlyInOrder8 import io.kotest.matchers.collections.shouldContainExactlyInOrderOnly9 import io.kotest.matchers.collections.shouldContainKey10 import io.kotest.matchers.collections.shouldContainKeys11 import io.kotest.matchers.collections.shouldContainValue12 import io.kotest.matchers.collections.shouldContainValues13 import io.kotest.matchers.collections.shouldHaveAtLeastSize14 import io.kotest.matchers.collections.shouldHaveAtMostSize15 import io.kotest.matchers.collections.shouldHaveSingleElement16 import io.kotest.matchers.collections.shouldHaveSize17 import io.kotest.matchers.collections.shouldHaveTheSameElementsAs18 import io.kotest.matchers.collections.shouldHaveTheSameSizeAs19 import io.kotest.matchers.collections.shouldNotContain20 import io.kotest.matchers.collections.shouldNotContainAll21 import io.kotest.matchers.collections.shouldNotContainExactlyInAnyOrder22 import io.kotest.matchers.collections.shouldNotContainExactlyInOrder23 import io.kotest.matchers.collections.shouldNotContainKey24 import io.kotest.matchers.collections.shouldNotContainKeys25 import io.kotest.matchers.collections.shouldNotContainValue26 import io.kotest.matchers.collections.shouldNotContainValues27 import io.kotest.matchers.collections.shouldNotHaveAtLeastSize28 import io.kotest.matchers.collections.shouldNotHaveAtMostSize29 import io.kotest.matchers.collections.shouldNotHaveSingleElement30 import io.kotest.matchers.collections.shouldNotHaveSize31 import io.kotest.matchers.collections.shouldNotHaveTheSameElementsAs32 import io.kotest.matchers.collections.shouldNotHaveTheSameSizeAs33 import io.kotest.matchers.collections.shouldNotIntersect34 import io.kotest.matchers.collections.shouldNotBeEmpty35 import io

Full Screen

Full Screen

singleton

Using AI Code Generation

copy

Full Screen

1 import io.kotest.matchers.collections.shouldContainAll2 import io.kotest.matchers.collections.shouldNotContainAll3 import io.kotest.matchers.collections.shouldHaveSize4 import io.kotest.matchers.collections.shouldNotHaveSize5 import io.kotest.matchers.collections.shouldBeEmpty6 import io.kotest.matchers.collections.shouldNotBeEmpty7 import io.kotest.matchers.collections.shouldContain8 import io.kotest.matchers.collections.shouldNotContain9 import io.kotest.matchers.collections.shouldContainInOrder10 import io.kotest.matchers.collections.shouldNotContainInOrder11 import io.kotest.matchers.collections.shouldContainInOrderOnly12 import io.kotest.matchers.collections.shouldNotContainInOrderOnly13 import io.kotest.matchers.collections.shouldContainExactly14 import io.kotest.matchers.collections.shouldNotContainExactly15 import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder16 import io.kotest.matchers.collections.shouldNotContainExactlyInAnyOrder17 import io.kotest.matchers.collections.shouldContainAnyOf18 import io.kotest.matchers.collections.shouldNotContainAnyOf19 import io.kotest.matchers.collections.shouldContainNoneOf20 import io.kotest.matchers.collections.shouldNotContainNoneOf21 import io.kotest.matchers.collections.shouldContainAllInAnyOrder22 import io.kotest.matchers.collections.shouldNotContainAllInAnyOrder23 import io.kotest.matchers.collections.shouldContainAllInOrder24 import io.kotest.matchers.collections.shouldNotContainAllInOrder25 import io.kotest.matchers.collections.shouldContainAllInOrderOnly26 import io.kotest.matchers.collections.shouldNotContainAllInOrderOnly27 import io.kotest.matchers.collections.shouldContainAllOf28 import io.kotest.matchers.collections.shouldNotContainAllOf29 import io.kotest.matchers.collections.shouldContainAllOfInAnyOrder30 import io.kotest.matchers.collections.shouldNotContainAllOfInAnyOrder31 import io.kotest.matchers.collections.shouldContainExactlyInAnyOrderElementsOf32 import io.kotest.matchers.collections.shouldNotContainExactlyInAnyOrderElementsOf33 import io.kotest.matchers.collections.shouldContainExactlyElementsOf

Full Screen

Full Screen

singleton

Using AI Code Generation

copy

Full Screen

1class TestClass {2fun test1() {3val list = listOf(1, 2, 3)4}5}6class TestClass {7fun test1() {8}9}10class TestClass {11fun test1() {12}13}14class TestClass {15fun test1() {16}17}18class TestClass {19fun test1() {20}21}22class TestClass {23fun test1() {24}25}26class TestClass {27fun test1() {28}29}30class TestClass {31fun test1() {32}33}34class TestClass {35fun test1() {36}

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