How to use should class of io.kotest.matchers package

Best Kotest code snippet using io.kotest.matchers.should

RoomsKtTest.kt

Source:RoomsKtTest.kt Github

copy

Full Screen

1package com.tylerkindy.betrayal.db2import com.tylerkindy.betrayal.Direction3import io.kotest.assertions.throwables.shouldThrow4import io.kotest.core.spec.style.DescribeSpec5import io.kotest.matchers.collections.shouldBeEmpty6import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder7import io.kotest.matchers.should8import io.kotest.matchers.shouldBe9import io.kotest.property.Arb10import io.kotest.property.Exhaustive11import io.kotest.property.arbitrary.ShortShrinker12import io.kotest.property.arbitrary.arbitrary13import io.kotest.property.arbitrary.enum14import io.kotest.property.arbitrary.set15import io.kotest.property.checkAll16import io.kotest.property.exhaustive.ints17import io.kotest.property.exhaustive.map18import io.kotest.property.forAll19import org.jetbrains.exposed.sql.insert20import org.jetbrains.exposed.sql.select21import org.jetbrains.exposed.sql.selectAll22import org.jetbrains.exposed.sql.transactions.transaction23import kotlin.random.nextInt24val directionSets = Arb.set(Arb.enum<Direction>(), 0..Direction.values().size)25val rotations = Exhaustive.ints(0..3).map { it.toShort() }26val invalidRotationValues = (Short.MIN_VALUE..Short.MAX_VALUE) - (0..3)27val invalidRotations = arbitrary(listOf(Short.MIN_VALUE, -1, 4, Short.MAX_VALUE), ShortShrinker) {28 it.random.nextInt(invalidRotationValues.indices).let { i -> invalidRotationValues[i] }.toShort()29}30class RoomsKtTest : DescribeSpec({31 useDatabase()32 describe("returnRoomToStack") {33 it("returns to empty stack") {34 transaction {35 val gameId = "ABCDEF"36 val stackId =37 RoomStacks.insert {38 it[this.gameId] = gameId39 it[curIndex] = null40 it[flipped] = false41 } get RoomStacks.id42 val roomId =43 Rooms.insert {44 it[this.gameId] = gameId45 it[roomDefId] = 1446 it[gridX] = 047 it[gridY] = 048 it[rotation] = 049 } get Rooms.id50 returnRoomToStack(gameId, roomId)51 Rooms.selectAll().shouldBeEmpty()52 val stackRows = RoomStacks.select { RoomStacks.id eq stackId }53 stackRows.count().shouldBe(1)54 stackRows.first().should {55 it[RoomStacks.curIndex].shouldBe(0)56 }57 RoomStackContents.select { RoomStackContents.stackId eq stackId }58 .first().should {59 it[RoomStackContents.index].shouldBe(0)60 it[RoomStackContents.roomDefId].shouldBe(14)61 }62 }63 }64 it("returns to non-empty stack") {65 transaction {66 val gameId = "ABCDEF"67 val stackId = RoomStacks.insert {68 it[this.gameId] = gameId69 it[curIndex] = 1770 it[flipped] = false71 } get RoomStacks.id72 RoomStackContents.insert {73 it[this.stackId] = stackId74 it[index] = 2575 it[roomDefId] = 976 }77 RoomStackContents.insert {78 it[this.stackId] = stackId79 it[index] = 1780 it[roomDefId] = 1381 }82 RoomStackContents.insert {83 it[this.stackId] = stackId84 it[index] = 385 it[roomDefId] = 2386 }87 val roomId = Rooms.insert {88 it[this.gameId] = gameId89 it[roomDefId] = 1490 it[gridX] = 091 it[gridY] = 092 it[rotation] = 093 } get Rooms.id94 returnRoomToStack(gameId, roomId)95 Rooms.selectAll().shouldBeEmpty()96 RoomStackContents.selectAll()97 .map { it[RoomStackContents.index] }98 .shouldContainExactlyInAnyOrder(0, 1, 2, 3)99 }100 }101 }102 describe("rotateDoors") {103 it("maintains number of directions") {104 forAll(directionSets, rotations) { dirs, rotation ->105 rotateDoors(dirs, rotation).size == dirs.size106 }107 }108 it("throws for invalid rotations") {109 checkAll(directionSets, invalidRotations) { dirs, rotation ->110 shouldThrow<IllegalArgumentException> { rotateDoors(dirs, rotation) }111 }112 }113 it("returns the same directions with no rotation") {114 forAll(directionSets) { dirs ->115 rotateDoors(dirs, 0) == dirs116 }117 }118 it("always returns all directions") {119 val allDirections = Direction.values().toSet()120 forAll(rotations) { rotation ->121 rotateDoors(allDirections, rotation) == allDirections122 }123 }124 it("rotates doors") {125 rotateDoors(126 setOf(Direction.NORTH, Direction.WEST),127 3128 ) shouldBe setOf(Direction.NORTH, Direction.EAST)129 }130 }131})...

Full Screen

Full Screen

VendedorTest.kt

Source:VendedorTest.kt Github

copy

Full Screen

1package ar.edu.unahur.obj2.vendedores2import io.kotest.assertions.throwables.shouldThrowAny3import io.kotest.core.spec.style.DescribeSpec4import io.kotest.matchers.booleans.shouldBeFalse5import io.kotest.matchers.booleans.shouldBeTrue6import io.kotest.matchers.collections.shouldContain7import io.kotest.matchers.collections.shouldContainAll8import io.kotest.matchers.collections.shouldNotContain9import io.kotest.matchers.should10import io.kotest.matchers.shouldBe11class ComercioTest : DescribeSpec({12 val buenosAires = Provincia(15000000)13 val santaFe = Provincia(9000000)14 val cordoba = Provincia(12000000)15 val entreRios = Provincia(1500000)16 val chivilcoy = Ciudad(buenosAires)17 val bragado = Ciudad(buenosAires)18 val lobos = Ciudad(buenosAires)19 val pergamino = Ciudad(buenosAires)20 val zarate = Ciudad(buenosAires)21 val rosario = Ciudad(santaFe)22 val rafaela = Ciudad(santaFe)23 val sanFrancisco = Ciudad(cordoba)24 val diamante = Ciudad(entreRios)25 val armstrong = Ciudad(santaFe)26 describe("Es influyente1") {27 val corresponsal = ComercioCorresponsal(listOf(chivilcoy, bragado, lobos, pergamino, zarate))28 it("5 ciudades") {29 corresponsal.esInfluyente().shouldBeTrue()30 }31 }32 describe("Es influyente2") {33 val corresponsal2 = ComercioCorresponsal(listOf(rosario, rafaela, sanFrancisco, diamante))34 it("3 provincias") {35 corresponsal2.esInfluyente().shouldBeTrue()36 }37 }38 describe("Es influyente3") {39 val corresponsal3 = ComercioCorresponsal(listOf(rosario, rafaela, armstrong, diamante))40 it("4 ciudades, 2 pcias") {41 corresponsal3.esInfluyente().shouldBeFalse()42 }43 }44})45class VendedorTest : DescribeSpec({46 val misiones = Provincia(1300000)47 val sanIgnacio = Ciudad(misiones)48 val certif1 = Certificacion(esDeProducto = true, puntaje = 10)49 val certif2 = Certificacion(esDeProducto = true, puntaje = 5)50 val certif3 = Certificacion(esDeProducto = false, puntaje = 9)51 describe("Vendedor fijo") {52 val obera = Ciudad(misiones)53 val vendedorFijo = VendedorFijo(obera)54 vendedorFijo.certificaciones.addAll(listOf(certif1, certif2, certif3))55 describe("Es versatil o firme") {56 it("es versatil") {57 vendedorFijo.esVersatil().shouldBeTrue()58 }59 it("es firme") {60 vendedorFijo.esFirme().shouldBeFalse()61 }62 }63 describe("puedeTrabajarEn") {64 it("su ciudad de origen") {65 vendedorFijo.puedeTrabajarEn(obera).shouldBeTrue()66 }67 it("otra ciudad") {68 vendedorFijo.puedeTrabajarEn(sanIgnacio).shouldBeFalse()69 }70 }71 }72 describe("Viajante") {73 val cordoba = Provincia(2000000)74 val villaDolores = Ciudad(cordoba)75 val viajante = Viajante(listOf(misiones))76 describe("puedeTrabajarEn") {77 it("una ciudad que pertenece a una provincia habilitada") {78 viajante.puedeTrabajarEn(sanIgnacio).shouldBeTrue()79 }80 it("una ciudad que no pertenece a una provincia habilitada") {81 viajante.puedeTrabajarEn(villaDolores).shouldBeFalse()82 }83 }84 }85})86class CentroDistribucionTest : DescribeSpec({87 val buenosAires = Provincia(15000000)88 val chivilcoy = Ciudad(buenosAires)89 val centro1 = CentroDeDistribucion(chivilcoy)90 val valeria = VendedorFijo(chivilcoy)91 val certif4 = Certificacion(esDeProducto = true, puntaje = 60)92 val certif5 = Certificacion(esDeProducto = true, puntaje = 5)93 val certif6 = Certificacion(esDeProducto = false, puntaje = 9)94 val malena = VendedorFijo(chivilcoy)95 valeria.certificaciones.addAll(listOf(certif5, certif6))96 malena.certificaciones.addAll(listOf(certif4, certif5, certif6))97 describe("Agregar vendedores") {98 it("Agregar un vendedor") {99 centro1.agregarVendedor(valeria)100 centro1.vendedores.shouldContain(valeria)101 }102 it("no permite agregar dos veces al mismo vendedor") {103 shouldThrowAny {104 centro1.agregarVendedor(valeria)105 }106 }107 }108 describe("Vendedores estrella") {109 centro1.agregarVendedor(malena)110 centro1.agregarVendedor(valeria)111 it("vendedor estrella") {112 centro1.vendedorEstrella().shouldBe(malena)113 }114 }115})...

Full Screen

Full Screen

Nel.kt

Source:Nel.kt Github

copy

Full Screen

1package io.kotest.assertions.arrow.core2import arrow.core.NonEmptyList3import io.kotest.matchers.collections.shouldBeSorted4import io.kotest.matchers.collections.shouldNotBeSorted5import io.kotest.matchers.collections.shouldBeUnique6import io.kotest.matchers.collections.shouldContain7import io.kotest.matchers.collections.shouldContainAll8import io.kotest.matchers.collections.shouldContainDuplicates9import io.kotest.matchers.collections.shouldContainNoNulls10import io.kotest.matchers.collections.shouldContainNull11import io.kotest.matchers.collections.shouldContainOnlyNulls12import io.kotest.matchers.collections.shouldHaveElementAt13import io.kotest.matchers.collections.shouldHaveSingleElement14import io.kotest.matchers.collections.shouldHaveSize15import io.kotest.matchers.collections.shouldNotHaveSize16import io.kotest.matchers.collections.shouldNotBeUnique17import io.kotest.matchers.collections.shouldNotContain18import io.kotest.matchers.collections.shouldNotContainAll19import io.kotest.matchers.collections.shouldNotContainDuplicates20import io.kotest.matchers.collections.shouldNotContainNoNulls21import io.kotest.matchers.collections.shouldNotContainNull22import io.kotest.matchers.collections.shouldNotContainOnlyNulls23import io.kotest.matchers.collections.shouldNotHaveElementAt24import io.kotest.matchers.collections.shouldNotHaveSingleElement25public fun <A> NonEmptyList<A>.shouldContainOnlyNulls(): NonEmptyList<A> =26 apply { all.shouldContainOnlyNulls() }27public fun <A> NonEmptyList<A>.shouldNotContainOnlyNulls(): NonEmptyList<A> =28 apply { all.shouldNotContainOnlyNulls() }29public fun <A> NonEmptyList<A>.shouldContainNull(): NonEmptyList<A> =30 apply { all.shouldContainNull() }31public fun <A> NonEmptyList<A>.shouldNotContainNull(): NonEmptyList<A> =32 apply { all.shouldNotContainNull() }33public fun <A> NonEmptyList<A>.shouldHaveElementAt(index: Int, element: A): Unit =34 all.shouldHaveElementAt(index, element)35public fun <A> NonEmptyList<A>.shouldNotHaveElementAt(index: Int, element: A): Unit =36 all.shouldNotHaveElementAt(index, element)37public fun <A> NonEmptyList<A>.shouldContainNoNulls(): NonEmptyList<A> =38 apply { all.shouldContainNoNulls() }39public fun <A> NonEmptyList<A>.shouldNotContainNoNulls(): NonEmptyList<A> =40 apply { all.shouldNotContainNoNulls() }41public infix fun <A> NonEmptyList<A>.shouldContain(a: A): Unit {42 all.shouldContain(a)43}44public infix fun <A> NonEmptyList<A>.shouldNotContain(a: A): Unit {45 all.shouldNotContain(a)46}47public fun <A> NonEmptyList<A>.shouldBeUnique(): NonEmptyList<A> =48 apply { all.shouldBeUnique() }49public fun <A> NonEmptyList<A>.shouldNotBeUnique(): NonEmptyList<A> =50 apply { all.shouldNotBeUnique() }51public fun <A> NonEmptyList<A>.shouldContainDuplicates(): NonEmptyList<A> =52 apply { all.shouldContainDuplicates() }53public fun <A> NonEmptyList<A>.shouldNotContainDuplicates(): NonEmptyList<A> =54 apply { all.shouldNotContainDuplicates() }55public fun <A> NonEmptyList<A>.shouldContainAll(vararg ts: A): Unit =56 all.shouldContainAll(*ts)57public fun <A> NonEmptyList<A>.shouldNotContainAll(vararg ts: A): Unit =58 all.shouldNotContainAll(*ts)59public infix fun <A> NonEmptyList<A>.shouldContainAll(ts: List<A>): Unit =60 all.shouldContainAll(ts)61public infix fun <A> NonEmptyList<A>.shouldNotContainAll(ts: List<A>): Unit =62 all.shouldNotContainAll(ts)63public infix fun <A> NonEmptyList<A>.shouldHaveSize(size: Int): NonEmptyList<A> =64 apply { all.shouldHaveSize(size) }65public infix fun <A> NonEmptyList<A>.shouldNotHaveSize(size: Int): NonEmptyList<A> =66 apply { all.shouldNotHaveSize(size) }67public infix fun <A> NonEmptyList<A>.shouldHaveSingleElement(a: A): Unit =68 all.shouldHaveSingleElement(a)69public infix fun <A> NonEmptyList<A>.shouldNotHaveSingleElement(a: A): Unit =70 all.shouldNotHaveSingleElement(a)71public fun <A : Comparable<A>> NonEmptyList<A>.shouldBeSorted(): NonEmptyList<A> =72 apply { all.shouldBeSorted() }73public fun <A : Comparable<A>> NonEmptyList<A>.shouldNotBeSorted(): NonEmptyList<A> =74 apply { all.shouldNotBeSorted() }...

Full Screen

Full Screen

InMemoryHopRepositoryTest.kt

Source:InMemoryHopRepositoryTest.kt Github

copy

Full Screen

...7import fixtures.sampleHop8import io.kotest.assertions.assertSoftly9import io.kotest.assertions.fail10import io.kotest.core.spec.style.ShouldSpec11import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder12import io.kotest.matchers.maps.shouldHaveSize13import io.kotest.matchers.nulls.shouldNotBeNull14import io.kotest.matchers.shouldBe15import io.kotest.matchers.string.shouldNotBeBlank16class InMemoryHopRepositoryTest : ShouldSpec({17 val repoUnderTest = InMemoryHopRepository()18 beforeEach {19 repoUnderTest.clear()20 }21 should("find hop by name") {22 // Givent23 repoUnderTest.save(sampleHop)24 repoUnderTest.save(sampleHop.copy(name = "Cascade", similarTo = listOf("Citra")))25 repoUnderTest.save(sampleHop.copy(name = "Chinook", similarTo = listOf("Cascade", "Citra", "Chinook")))26 // When & Then27 repoUnderTest.findByName("Citra").shouldNotBeNull().apply {28 assertSoftly {29 name shouldBe "Citra"30 country.shouldContainExactlyInAnyOrder(Country.USA)31 alpha shouldBe PercentRange(10.0, 12.0)32 beta shouldBe PercentRange(3.5, 4.5)33 coH shouldBe PercentRange(22.0, 24.0)34 type.shouldContainExactlyInAnyOrder(HopType.AROMATIC, HopType.BITTERING)35 profile.shouldNotBeBlank()36 similarTo.shouldContainExactlyInAnyOrder("Cascade", "Centennial", "Chinook")37 }38 }39 }40 should("get all") {41 // Given42 repoUnderTest.save(sampleHop)43 repoUnderTest.save(sampleHop.copy(name = "Cascade", similarTo = listOf("Citra")))44 repoUnderTest.save(sampleHop.copy(name = "Chinook", similarTo = listOf("Cascade", "Citra", "Chinook")))45 // When46 val res = repoUnderTest.getAll()47 // Then48 res shouldHaveSize 349 res["CASCADE"] shouldBe Hop(50 name = "Cascade",51 country = listOf(Country.USA),52 alpha = PercentRange(from = 10.0, to = 12.0),53 beta = PercentRange(from = 3.5, to = 4.5),54 coH = PercentRange(from = 22.0, to = 24.0),55 oil = QuantityRange(from = 1.5, to = 3.0),56 type = listOf(HopType.BITTERING, HopType.AROMATIC),57 profile = "Agrumes, pamplemousse, fruit de la passion",58 similarTo = listOf("Citra"),59 )60 }61 should("find all similar hops") {62 // Given63 repoUnderTest.save(sampleHop)64 repoUnderTest.save(sampleHop.copy(name = "Cascade", similarTo = listOf("Citra")))65 repoUnderTest.save(sampleHop.copy(name = "Centennial", similarTo = emptyList()))66 repoUnderTest.save(sampleHop.copy(name = "Chinook", similarTo = listOf("Cascade", "Citra", "Centennial")))67 val rootHop = repoUnderTest.findByName("Chinook") ?: fail("initialization error")68 // When & Then69 repoUnderTest.findSimilar(rootHop).shouldContainExactlyInAnyOrder(70 repoUnderTest.findByName("Cascade"),71 repoUnderTest.findByName("Centennial"),72 repoUnderTest.findByName("Citra"),73 )74 }75})...

Full Screen

Full Screen

CoroutineTransactionalApplicationTests.kt

Source:CoroutineTransactionalApplicationTests.kt Github

copy

Full Screen

...4import br.com.demo.coroutine_transactional.domain.book.model.BookDefinition5import br.com.demo.coroutine_transactional.persistence.PersistenceConfiguration6import br.com.demo.coroutine_transactional.persistence.repository.JPAAuthorRepository7import br.com.demo.coroutine_transactional.persistence.repository.JPABookRepository8import io.kotest.assertions.throwables.shouldThrowAny9import io.kotest.core.spec.style.StringSpec10import io.kotest.extensions.spring.SpringExtension11import io.kotest.matchers.booleans.shouldBeFalse12import io.kotest.matchers.booleans.shouldBeTrue13import io.kotest.property.Arb14import io.kotest.property.arbitrary.arbitrary15import io.kotest.property.arbitrary.bool16import io.kotest.property.arbitrary.next17import io.kotest.property.arbitrary.string18import io.kotest.property.arbitrary.uuid19import io.kotest.property.checkAll20import org.springframework.beans.factory.annotation.Autowired21import org.springframework.test.context.ContextConfiguration22@ContextConfiguration(classes = [PersistenceConfiguration::class])23class CoroutineTransactionalApplicationTests : StringSpec() {24 @Autowired25 lateinit var bookService: BookService26 @Autowired27 lateinit var jpaAuthorRepository: JPAAuthorRepository28 @Autowired29 lateinit var jpaBookRepository: JPABookRepository30 override fun extensions() = listOf(SpringExtension)31 init {32 "validate @Transactional commit/rollback behaviour when using coroutine" {33 val bookGenerator = arbitrary { rs ->34 BookDefinition(35 id = Arb.uuid().next(rs).toString(),36 isbn = Arb.string().next(rs),37 title = Arb.string().next(rs),38 author = AuthorDefinition(39 id = Arb.uuid().next(rs).toString(),40 name = Arb.uuid().next(rs).toString(),41 )42 )43 }44 checkAll(bookGenerator, Arb.bool()) { book, shouldThrows ->45 if (shouldThrows) {46 shouldThrowAny { bookService.publish(book, shouldThrows) }47 jpaAuthorRepository.existsById(book.author.id).shouldBeFalse()48 jpaBookRepository.existsById(book.id).shouldBeFalse()49 } else {50 bookService.publish(book, shouldThrows)51 jpaAuthorRepository.existsById(book.author.id).shouldBeTrue()52 jpaBookRepository.existsById(book.id).shouldBeTrue()53 }54 }55 }56 }57}...

Full Screen

Full Screen

CategoryRepositorySelectSpec.kt

Source:CategoryRepositorySelectSpec.kt Github

copy

Full Screen

1package com.gaveship.category.domain.model2import com.gaveship.category.Mock3import io.kotest.core.spec.style.StringSpec4import io.kotest.matchers.collections.shouldHaveSize5import io.kotest.matchers.collections.singleElement6import io.kotest.matchers.nulls.beNull7import io.kotest.matchers.shouldBe8import io.kotest.matchers.shouldHave9import io.kotest.matchers.shouldNot10import io.kotest.property.arbitrary.chunked11import io.kotest.property.arbitrary.single12import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest13import org.springframework.data.jpa.repository.config.EnableJpaAuditing14@EnableJpaAuditing15@DataJpaTest(16 showSql = true,17 properties = [18 "spring.flyway.enabled=false",19 "spring.jpa.hibernate.ddl-auto=create"20 ]21)22class CategoryRepositorySelectSpec(23 private val categoryRepository: CategoryRepository24) : StringSpec() {25 init {26 "Root Categories 조회 성공 Test" {27 val targetCategory = Mock.category().single()28 val savedCategory = categoryRepository.save(targetCategory)29 val savedCategoryId = savedCategory.id ?: throw IllegalArgumentException()30 val foundCategories = categoryRepository.findAll()31 foundCategories shouldHaveSize 132 foundCategories shouldHave singleElement { it.id == savedCategoryId }33 }34 "ID를 통한 Category 조회 성공 Test" {35 val categoryChildren = Mock.category().chunked(10, 10).single()36 val targetCategory = Mock.category(children = categoryChildren).single()37 val savedCategory = categoryRepository.save(targetCategory)38 val savedCategoryId = savedCategory.id ?: throw IllegalArgumentException()39 val foundCategory = categoryRepository.findById(savedCategoryId).get()40 foundCategory.name shouldBe savedCategory.name41 foundCategory.children shouldNot beNull()42 foundCategory.children!!.map { it.name } shouldBe43 targetCategory.children!!.map { it.name }44 }45 }46}...

Full Screen

Full Screen

PropertyBasedTestingSpec.kt

Source:PropertyBasedTestingSpec.kt Github

copy

Full Screen

1package sandbox.samples2import io.kotest.core.spec.style.StringSpec3import io.kotest.inspectors.forAll4import io.kotest.matchers.comparables.shouldBeGreaterThan5import io.kotest.matchers.shouldNotBe6import io.kotest.matchers.string.shouldHaveLength7import io.kotest.matchers.types.shouldBeInstanceOf8import io.kotest.property.Arb9import io.kotest.property.arbitrary.bind10import io.kotest.property.arbitrary.default11import io.kotest.property.arbitrary.positiveInts12import io.kotest.property.arbitrary.string13import io.kotest.property.checkAll14class PropertyBasedTestingSpec : StringSpec() {15 data class Person(val name: String, val age: Int)16 init {17 "can do property-based testing - with 100 examples" {18 checkAll<String, String> { a, b ->19 (a + b) shouldHaveLength(a.length + b.length)20 }21 }22 // This does not work :-(23 /*24 "can run a defined number of tests" {25 forAll(100) { a: String, b: String ->26 (a + b).length shouldBe a.length + b.length27 }28 }29 */30 "generate the defaults for list" {31 val gen = Arb.default<List<Int>>()32 checkAll(10, gen) { list ->33 list.forAll { i ->34 i.shouldBeInstanceOf<Int>()35 }36 }37 }38 "generate the defaults for set" {39 val gen = Arb.default<Set<String>>()40 checkAll(gen) { inst ->41 inst.forAll { i ->42 i.shouldBeInstanceOf<String>()43 }44 }45 }46 "string size" {47 checkAll<String, String> { a, b ->48 (a + b) shouldHaveLength(a.length + b.length)49 }50 }51 "person generator" {52 val gen = Arb.bind(Arb.string(), Arb.positiveInts(), ::Person)53 checkAll(gen) {54 it.name shouldNotBe null55 it.age shouldBeGreaterThan(0)56 }57 }58 }59}...

Full Screen

Full Screen

ToudouSteps.kt

Source:ToudouSteps.kt Github

copy

Full Screen

2import fr.lidonis.toudou.Label3import fr.lidonis.toudou.Toudou4import fr.lidonis.toudou.Toudous5import io.cucumber.java8.En6import io.kotest.matchers.collections.shouldBeEmpty7import io.kotest.matchers.shouldBe8import io.kotest.matchers.shouldNot9import io.kotest.matchers.string.beEmpty10class ToudouSteps : En {11 private lateinit var toudous: Toudous12 private lateinit var toudouList: List<Toudou>13 private lateinit var toudou: Toudou14 init {15 Given("Empty/A toudous") {16 toudous = Toudous()17 }18 When("I list all toudous") {19 toudouList = toudous.all20 }21 When("I add a toudou with label {string}") { label: String ->22 toudou = toudous.add(Label(label))23 }24 Then("my toudous are empty") {25 toudouList.shouldBeEmpty()26 }27 Then("a toudou should be created") {}28 Then("the toudou should have an Id") {29 toudou.toudouId.toString() shouldNot beEmpty()30 }31 Then("the toudou should have a label {string}") { label: String ->32 toudou.label.value shouldBe label33 }34 }35}...

Full Screen

Full Screen

should

Using AI Code Generation

copy

Full Screen

1 import io.kotest.assertions.shouldBe2 import io.kotest.assertions.shouldNotBe3 import io.kotest.assertions.shouldNotThrow4 import io.kotest.assertions.shouldThrow5 import io.kotest.assertions.shouldBeInstanceOf6 import io.kotest.assertions.shouldNotBeInstanceOf7 import io.kotest.matchers.shouldBe8 import io.kotest

Full Screen

Full Screen

should

Using AI Code Generation

copy

Full Screen

1import io.kotest.matchers.shouldBe2import io.kotest.matchers.shouldNotBe3import io.kotest.matchers.shouldNotThrow4import io.kotest.matchers.shouldThrow5import io.kotest.matchers.shouldNotThrowAny6import io.kotest.matchers.shouldThrowAny7import io.kotest.matchers.shouldNotThrowExactly8import io.kotest.matchers.shouldThrowExactly9import io.kotest.matchers.shouldNotThrowUnit10import io.kotest.matchers.shouldThrowUnit11import io.kotest.matchers.shouldBeInstanceOf

Full Screen

Full Screen

should

Using AI Code Generation

copy

Full Screen

1import io.kotest.matchers.shouldBe2class Test {3fun test() {4}5}6import org.junit.jupiter.api.Test7import org.junit.jupiter.api.Assertions.*8class Test {9fun test() {10should(a).be(b)11}12}13import org.junit.Test14import org.junit.Assert.*15class Test {16fun test() {17should(a).be(b)18}19}20import org.testng.annotations.Test21import org.testng.Assert.*22class Test {23fun test() {24should(a).be(b)25}26}27import org.junit.Test28import org.assertj.core.api.Assertions.*29class Test {30fun test() {31should(a).be(b)32}33}34import io.kotest.assertions.shouldBe35class Test {36fun test() {37}38}39import org.junit.jupiter.api.Test40import org.junit.jupiter.api.Assertions.*41class Test {42fun test() {43}44}45import org.junit.Test46import org.junit.Assert.*47class Test {48fun test() {49}50}

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.

Most used methods in should

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful