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

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

ShouldContainExactlyTest.kt

Source:ShouldContainExactlyTest.kt Github

copy

Full Screen

2import io.kotest.assertions.shouldFail3import io.kotest.assertions.throwables.shouldThrow4import io.kotest.core.spec.style.WordSpec5import io.kotest.matchers.collections.containExactly6import io.kotest.matchers.collections.containExactlyInAnyOrder7import io.kotest.matchers.collections.shouldContainExactly8import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder9import io.kotest.matchers.collections.shouldNotContainExactly10import io.kotest.matchers.collections.shouldNotContainExactlyInAnyOrder11import io.kotest.matchers.should12import io.kotest.matchers.shouldBe13import io.kotest.matchers.shouldNot14import io.kotest.matchers.throwable.shouldHaveMessage15import java.io.File16import java.nio.file.Path17import java.nio.file.Paths18class ShouldContainExactlyTest : WordSpec() {19 init {20 "containExactly" should {21 "test that an array contains given elements exactly" {22 val actual = arrayOf(1, 2, 3)23 actual.shouldContainExactly(1, 2, 3)24 actual shouldContainExactly arrayOf(1, 2, 3)25 actual.shouldNotContainExactly(3, 2, 1)26 actual shouldNotContainExactly arrayOf(3, 2, 1)27 shouldThrow<AssertionError> {28 actual.shouldContainExactly(3, 2, 1)29 }30 shouldThrow<AssertionError> {31 actual shouldContainExactly arrayOf(3, 2, 1)32 }33 shouldThrow<AssertionError> {34 actual.shouldNotContainExactly(1, 2, 3)35 }36 shouldThrow<AssertionError> {37 actual shouldNotContainExactly arrayOf(1, 2, 3)38 }39 val actualNull: Array<Int>? = null40 shouldThrow<AssertionError> {41 actualNull.shouldContainExactly(1, 2, 3)42 }.shouldHaveMessage("Expecting actual not to be null")43 shouldThrow<AssertionError> {44 actualNull.shouldNotContainExactly()45 }.shouldHaveMessage("Expecting actual not to be null")46 }47 "test that a collection contains given elements exactly" {48 val actual = listOf(1, 2, 3)49 emptyList<Int>() should containExactly()50 actual should containExactly(1, 2, 3)51 actual.shouldContainExactly(1, 2, 3)52 actual.toSet().shouldContainExactly(linkedSetOf(1, 2, 3))53 actual shouldNot containExactly(1, 2)54 actual.shouldNotContainExactly(3, 2, 1)55 actual.shouldNotContainExactly(listOf(5, 6, 7))56 shouldThrow<AssertionError> {57 actual should containExactly(1, 2)58 }59 shouldThrow<AssertionError> {60 actual should containExactly(1, 2, 3, 4)61 }62 shouldThrow<AssertionError> {63 actual.shouldContainExactly(3, 2, 1)64 }65 }66 "test contains exactly for byte arrays" {67 listOf("hello".toByteArray()) shouldContainExactly listOf("hello".toByteArray())68 listOf("helloworld".toByteArray()) shouldNotContainExactly listOf("hello".toByteArray())69 }70 "print errors unambiguously" {71 shouldThrow<AssertionError> {72 listOf<Any>(1L, 2L).shouldContainExactly(listOf<Any>(1, 2))73 } shouldHaveMessage74 """75 |Expecting: [1, 2] but was: [1L, 2L]76 |Some elements were missing: [1, 2] and some elements were unexpected: [1L, 2L]77 |expected:<[1, 2]> but was:<[1L, 2L]>78 """.trimMargin()79 }80 "informs user of illegal comparisons" {81 shouldFail {82 HashSet(setOf(1, 2, 3)) shouldContainExactly listOf(1, 2, 3)83 }.message shouldBe """Disallowed: Set can be compared only to Set84 |May not compare HashSet with ArrayList85 |expected:<*> but was:<*>86 |87 |""".trimMargin()88 }89 "print dataclasses" {90 shouldThrow<AssertionError> {91 listOf(92 Blonde("foo", true, 23423, inputPath),93 Blonde("woo", true, 97821, inputPath),94 Blonde("goo", true, 51984, inputPath)95 ).shouldContainExactly(96 Blonde("foo", true, 23423, inputPath),97 Blonde("woo", true, 97821, inputPath)98 )99 }.message?.trim() shouldBe100 """101 |Expecting: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath)] but was: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath), Blonde(a=goo, b=true, c=51984, p=$expectedPath)]102 |Some elements were unexpected: [Blonde(a=goo, b=true, c=51984, p=$expectedPath)]103 |expected:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath)]> but was:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath), Blonde(a=goo, b=true, c=51984, p=$expectedPath)]>104 """.trimMargin()105 }106 "include extras when too many" {107 shouldThrow<AssertionError> {108 listOf(109 Blonde("foo", true, 23423, inputPath)110 ).shouldContainExactly(111 Blonde("foo", true, 23423, inputPath),112 Blonde("woo", true, 97821, inputPath)113 )114 }.message?.trim() shouldBe115 """116 |Expecting: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath)] but was: [Blonde(a=foo, b=true, c=23423, p=$expectedPath)]117 |Some elements were missing: [Blonde(a=woo, b=true, c=97821, p=$expectedPath)]118 |expected:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=woo, b=true, c=97821, p=$expectedPath)]> but was:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath)]>119 """.trimMargin()120 }121 "include missing when too few" {122 shouldThrow<AssertionError> {123 listOf(124 Blonde("foo", true, 23423, inputPath),125 Blonde("hoo", true, 96915, inputPath)126 ).shouldContainExactly(127 Blonde("woo", true, 97821, inputPath)128 )129 }.message?.trim() shouldBe130 """131 |Expecting: [Blonde(a=woo, b=true, c=97821, p=$expectedPath)] but was: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]132 |Some elements were missing: [Blonde(a=woo, b=true, c=97821, p=$expectedPath)] and some elements were unexpected: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]133 |expected:<[Blonde(a=woo, b=true, c=97821, p=$expectedPath)]> but was:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]>134 """.trimMargin()135 }136 "include missing and extras when not the right amount" {137 shouldThrow<AssertionError> {138 listOf(139 Blonde("foo", true, 23423, inputPath),140 Blonde("hoo", true, 96915, inputPath)141 ).shouldContainExactly(142 Blonde("woo", true, 97821, inputPath),143 Blonde("goo", true, 51984, inputPath)144 )145 }.message?.trim() shouldBe146 """147 |Expecting: [Blonde(a=woo, b=true, c=97821, p=$expectedPath), Blonde(a=goo, b=true, c=51984, p=$expectedPath)] but was: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]148 |Some elements were missing: [Blonde(a=woo, b=true, c=97821, p=$expectedPath), Blonde(a=goo, b=true, c=51984, p=$expectedPath)] and some elements were unexpected: [Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]149 |expected:<[Blonde(a=woo, b=true, c=97821, p=$expectedPath), Blonde(a=goo, b=true, c=51984, p=$expectedPath)]> but was:<[Blonde(a=foo, b=true, c=23423, p=$expectedPath), Blonde(a=hoo, b=true, c=96915, p=$expectedPath)]>150 """.trimMargin()151 }152 }153 "containExactlyInAnyOrder" should {154 "test that a collection contains given elements exactly in any order" {155 val actual = listOf(1, 2, 3)156 actual should containExactlyInAnyOrder(1, 2, 3)157 actual.shouldContainExactlyInAnyOrder(3, 2, 1)158 actual.shouldContainExactlyInAnyOrder(linkedSetOf(2, 1, 3))159 actual shouldNot containExactlyInAnyOrder(1, 2)160 actual.shouldNotContainExactlyInAnyOrder(1, 2, 3, 4)161 actual.shouldNotContainExactlyInAnyOrder(listOf(5, 6, 7))162 actual.shouldNotContainExactlyInAnyOrder(1, 1, 1)163 actual.shouldNotContainExactlyInAnyOrder(listOf(2, 2, 3))164 actual.shouldNotContainExactlyInAnyOrder(listOf(1, 1, 2, 3))165 val actualDuplicates = listOf(1, 1, 2)166 actualDuplicates.shouldContainExactlyInAnyOrder(1, 2, 1)167 actualDuplicates.shouldContainExactlyInAnyOrder(2, 1, 1)168 actualDuplicates.shouldNotContainExactlyInAnyOrder(1, 2)169 actualDuplicates.shouldNotContainExactlyInAnyOrder(1, 2, 2)170 actualDuplicates.shouldNotContainExactlyInAnyOrder(1, 1, 2, 2)171 actualDuplicates.shouldNotContainExactlyInAnyOrder(1, 2, 7)172 shouldThrow<AssertionError> {173 actual should containExactlyInAnyOrder(1, 2)174 }175 shouldThrow<AssertionError> {176 actual should containExactlyInAnyOrder(1, 2, 3, 4)177 }178 shouldThrow<AssertionError> {179 actual should containExactlyInAnyOrder(1, 1, 1)180 }181 shouldThrow<AssertionError> {182 actual should containExactlyInAnyOrder(1, 1, 2, 3)183 }184 shouldThrow<AssertionError> {185 actualDuplicates should containExactlyInAnyOrder(1, 2, 2)186 }187 }188 "print errors unambiguously" {189 shouldThrow<AssertionError> {190 listOf<Any>(1L, 2L).shouldContainExactlyInAnyOrder(listOf<Any>(1, 2))191 }.shouldHaveMessage("Collection should contain [1, 2] in any order, but was [1L, 2L]")192 }193 "disambiguate when using optional expected value" {194 val actual: List<String> = listOf("A", "B", "C")195 val expected: List<String>? = listOf("A", "B", "C")196 actual.shouldContainExactlyInAnyOrder(expected)197 }198 }199 }...

Full Screen

Full Screen

SearchByNameViewModelSpec.kt

Source:SearchByNameViewModelSpec.kt Github

copy

Full Screen

1package net.subroh0508.colormaster.presentation.search.spec2import io.kotest.core.test.TestCase3import io.kotest.matchers.be4import io.kotest.matchers.collections.beEmpty5import io.kotest.matchers.collections.containExactlyInAnyOrder6import io.kotest.matchers.collections.haveSize7import io.kotest.matchers.nulls.beNull8import io.kotest.matchers.should9import kotlinx.coroutines.flow.launchIn10import kotlinx.coroutines.flow.onEach11import net.subroh0508.colormaster.model.*12import net.subroh0508.colormaster.presentation.search.MockIdolColorsRepository13import net.subroh0508.colormaster.presentation.search.everyRand14import net.subroh0508.colormaster.presentation.search.everySearchByName15import net.subroh0508.colormaster.presentation.search.model.IdolColorListItem16import net.subroh0508.colormaster.presentation.search.model.SearchUiModel17import net.subroh0508.colormaster.presentation.search.model.SearchParams18import net.subroh0508.colormaster.presentation.search.viewmodel.SearchByNameViewModel19import net.subroh0508.colormaster.test.TestScope20import net.subroh0508.colormaster.test.ViewModelSpec21class SearchByNameViewModelSpec : ViewModelSpec() {22 private val observedUiModels: MutableList<SearchUiModel> = mutableListOf()23 private val repository = MockIdolColorsRepository()24 lateinit var viewModel: SearchByNameViewModel25 override fun beforeTest(testCase: TestCase) {26 super.beforeTest(testCase)27 viewModel = SearchByNameViewModel(repository, TestScope()/* for JS Runtime */)28 observedUiModels.clear()29 viewModel.uiModel.onEach { observedUiModels.add(it) }30 .launchIn(TestScope())31 }32 private val randomIdols = listOf(33 IdolColor("Shimabara_Elena", "島原エレナ", HexColor("9BCE92")),34 IdolColor("Abe_nana", "安部菜々", HexColor("E64A79")),35 IdolColor("Kohinata_Miho", "小日向美穂", HexColor("C64796")),36 IdolColor("Sakuma_Mayu", "佐久間まゆ", HexColor("D1197B")),37 IdolColor("Hidaka_Ai", "日高愛", HexColor("E85786")),38 IdolColor("Nakatani_Iku", "中谷育", HexColor("F7E78E")),39 IdolColor("Taiga_Takeru", "大河タケル", HexColor("0E0C9F")),40 IdolColor("Kuzunoha_Amehiko", "葛之葉雨彦", HexColor("111721")),41 IdolColor("Suou_Momoko", "周防桃子", HexColor("EFB864")),42 IdolColor("Ichikawa_Hinana", "市川雛菜", HexColor("FFC639")),43 )44 private val byName = IdolName("久川")45 private val byNameIdols = listOf(46 IdolColor("Hisakawa_Nagi", "久川凪", HexColor("F7A1BA")),47 IdolColor("Hisakawa_Hayate", "久川颯", HexColor("7ADAD6")),48 )49 private val byBrand = Brands._87650 private val byBrandIdols = listOf(51 IdolColor("Hidaka_Ai", "日高愛", HexColor("E85786")),52 IdolColor("Mizutani_Eri", "水谷絵理", HexColor("00ADB9")),53 IdolColor("Akizuki_Ryo_876", "秋月涼", HexColor("B2D468")),54 )55 56 private val byBrandAndType = Brands._765 to Types.MILLION_LIVE.PRINCESS57 private val byBrandAndTypeIdols = listOf(58 IdolColor("Amami_Haruka", "天海春香", HexColor("E22B30")),59 IdolColor("Ganaha_Hibiki", "我那覇響", HexColor("01ADB9")),60 IdolColor("Kikuchi_Makoto", "菊地真", HexColor("515558")),61 IdolColor("Hagiwara_Yukiho", "萩原雪歩", HexColor("D3DDE9")),62 )63 private fun subject(block: () -> Unit): List<SearchUiModel> {64 block()65 return observedUiModels66 }67 private val emptyParams = SearchParams.ByName.EMPTY68 init {69 test("#search: when repository#rand returns idols colors it should post SearchUiModel with filled list") {70 repository.everyRand { randomIdols }71 subject(viewModel::search).also { models ->72 models should haveSize(3)73 models[0] should {74 it.items should beEmpty()75 it.error should beNull()76 it.isLoading should be(false)77 }78 models[1] should {79 it.items should beEmpty()80 it.error should beNull()81 it.isLoading should be(true)82 }83 models[2] should {84 it.items should containExactlyInAnyOrder(randomIdols.map(::IdolColorListItem))85 it.error should beNull()86 it.isLoading should be(false)87 }88 }89 }90 test("#search: when repository#rand raise Exception it should post SearchUiModel with empty list") {91 val error = IllegalStateException()92 repository.everyRand { throw error }93 subject(viewModel::search).also { models ->94 models should haveSize(3)95 models[0] should {96 it.items should beEmpty()97 it.error should beNull()98 it.isLoading should be(false)99 }100 models[1] should {101 it.items should beEmpty()102 it.error should beNull()103 it.isLoading should be(true)104 }105 models[2] should {106 it.items should beEmpty()107 it.error should be(error)108 it.isLoading should be(false)109 }110 }111 }112 test("#changeIdolNameSuggestQuery: when input name it should post SearchUiModel with filled list") {113 repository.everySearchByName(expectIdolName = byName) { _, _, _ -> byNameIdols }114 subject { viewModel.changeIdolNameSearchQuery(byName.value) }.also { models ->115 models should haveSize(4)116 models.last() should {117 it.items should containExactlyInAnyOrder(byNameIdols.map(::IdolColorListItem))118 it.params should be(emptyParams.copy(idolName = byName))119 }120 }121 }122 test("#setSearchParams: when change brand it should post SearchUiModel with filled list") {123 repository.everySearchByName(expectBrands = byBrand) { _, _, _ -> byBrandIdols }124 subject { viewModel.setSearchParams(emptyParams.change(byBrand)) }.also { models ->125 models should haveSize(4)126 models.last() should {127 it.items should containExactlyInAnyOrder(byBrandIdols.map(::IdolColorListItem))128 it.params should be(emptyParams.copy(brands = byBrand))129 }130 }131 }132 test("#setSearchParams: when change brand and type it should post SearchUiModel with filled list") {133 val (brand, type) = byBrandAndType134 repository.everySearchByName(expectBrands = brand, expectTypes = setOf(type)) { _, _, _ -> byBrandAndTypeIdols }135 subject { viewModel.setSearchParams(emptyParams.change(brand).change(type, checked = true)) }.also { models ->136 models should haveSize(4)137 models.last() should {138 it.items should containExactlyInAnyOrder(byBrandAndTypeIdols.map(::IdolColorListItem))139 it.params should be(emptyParams.copy(brands = brand, types = setOf(type)))140 }141 }142 }143 test("#select: when change selected item it should post SearchUiModel with select state") {144 repository.everyRand { randomIdols }145 subject {146 viewModel.search()147 viewModel.select(randomIdols[0], true)148 viewModel.select(randomIdols[0], false)149 }.also { models ->150 models should haveSize(5)151 models[models.lastIndex - 1] should {152 it.items should haveSize(randomIdols.size)153 it.selectedItems should be(listOf(randomIdols[0]))154 }155 models.last() should {156 it.items should haveSize(randomIdols.size)157 it.selectedItems should beEmpty()158 }159 }160 }161 test("#selectAll: when change selected item it should post SearchUiModel with select state") {162 repository.everyRand { randomIdols }163 subject {164 viewModel.search()165 viewModel.selectAll(true)166 viewModel.selectAll(false)167 }.also { models ->168 models should haveSize(5)169 models[models.lastIndex - 1] should {170 it.items should haveSize(randomIdols.size)171 it.selectedItems should containExactlyInAnyOrder(randomIdols)172 }173 models.last() should {174 it.items should haveSize(randomIdols.size)175 it.selectedItems should beEmpty()176 }177 }178 }179 }180}...

Full Screen

Full Screen

DeviceRepositoryTestBase.kt

Source:DeviceRepositoryTestBase.kt Github

copy

Full Screen

...8import de.igorakkerman.demo.deviceconfig.application.DisplayUpdate9import de.igorakkerman.demo.deviceconfig.application.Resolution10import io.kotest.assertions.throwables.shouldThrow11import io.kotest.matchers.collections.beEmpty12import io.kotest.matchers.collections.containExactlyInAnyOrder13import io.kotest.matchers.sequences.shouldExist14import io.kotest.matchers.should15import io.kotest.matchers.shouldBe16import org.junit.jupiter.api.Test17import org.springframework.transaction.annotation.Propagation18import org.springframework.transaction.annotation.Transactional19import javax.validation.ConstraintViolationException20@Transactional21abstract class DeviceRepositoryTestBase(22 private val deviceRepository: DeviceRepository,23) {24 private val computer = Computer(25 id = "pc-win10-0815",26 name = "workpc-0815",27 username = "root",28 password = "topsecret",29 ipAddress = "127.0.0.1",30 )31 private val display = Display(32 id = "screen-samsung4k-4711",33 name = "workscreen-4711",34 resolution = Resolution.UHD35 )36 @Test37 fun `create two Devices, findDeviceById should find the right one`() {38 // given39 deviceRepository.createDevice(computer)40 deviceRepository.createDevice(display)41 flushAndClear()42 // when43 val foundComputer = deviceRepository.findDeviceById(computer.id)44 val foundDisplay = deviceRepository.findDeviceById(display.id)45 // then46 foundComputer shouldBe computer47 foundDisplay shouldBe display48 }49 @Test50 fun `create Device, findDeviceById should not find by unknown id`() {51 // given52 deviceRepository.createDevice(computer)53 flushAndClear()54 // when / then55 shouldThrow<DeviceNotFoundException> {56 deviceRepository.findDeviceById(display.id)57 }58 }59 @Test60 fun `create two Devices, findDeviceTypeById should find the type`() {61 // given62 deviceRepository.createDevice(computer)63 deviceRepository.createDevice(display)64 flushAndClear()65 // when66 val foundDisplayType = deviceRepository.findDeviceTypeById(display.id)67 val foundComputerType = deviceRepository.findDeviceTypeById(computer.id)68 // then69 foundComputerType shouldBe Computer::class70 foundDisplayType shouldBe Display::class71 }72 @Test73 fun `creating two Devices of same type with the same id should throw Exception`() {74 // given75 deviceRepository.createDevice(computer)76 flushAndClear()77 // when/then78 shouldThrow<DeviceAreadyExistsException> {79 deviceRepository.createDevice(80 computer.copy(81 id = computer.id,82 name = "different name",83 username = "different username"84 )85 )86 flushAndClear()87 }88 }89 @Test90 fun `creating two Devices of different type with the same id should throw Exception`() {91 // given92 deviceRepository.createDevice(computer)93 flushAndClear()94 // when/then95 shouldThrow<DeviceAreadyExistsException> {96 deviceRepository.createDevice(97 display.copy(98 id = computer.id99 )100 )101 flushAndClear()102 }103 }104 @Test105 fun `create, then update data of Computer, findDeviceById should return updated values`() {106 // given107 deviceRepository.createDevice(computer)108 flushAndClear()109 val computerUpdate = ComputerUpdate(110 name = "deskscreen-0815",111 ipAddress = "192.168.178.111"112 )113 // when114 deviceRepository.updateDevice(computer.id, computerUpdate)115 flushAndClear()116 // then117 val foundDevice = deviceRepository.findDeviceById(computer.id)118 foundDevice shouldBe computer.copy(119 name = computerUpdate.name!!,120 ipAddress = computerUpdate.ipAddress!!121 )122 }123 @Test124 fun `create, then update data of Display, findDeviceById should return updated values`() {125 // given126 deviceRepository.createDevice(display)127 flushAndClear()128 val displayUpdate = DisplayUpdate(129 name = "deskscreen-0815",130 resolution = Resolution.HD131 )132 // when133 deviceRepository.updateDevice(display.id, displayUpdate)134 flushAndClear()135 // then136 val foundDevice = deviceRepository.findDeviceById(display.id)137 foundDevice shouldBe display.copy(138 name = displayUpdate.name!!,139 resolution = displayUpdate.resolution!!140 )141 }142 @Test143 fun `update data in unknown device should throw Exception`() {144 // given145 // empty database146 // when/then147 shouldThrow<DeviceNotFoundException> {148 deviceRepository.updateDevice("unknown-id", DisplayUpdate())149 }150 }151 @Test152 fun `create, then replace Computer, findDeviceById should return updated values`() {153 // given154 deviceRepository.createDevice(computer)155 flushAndClear()156 // when157 val updatedComputer = computer.copy(158 name = "deskpc-0815",159 ipAddress = "34.245.198.211"160 )161 deviceRepository.replaceDevice(updatedComputer)162 flushAndClear()163 // then164 val foundDevice = deviceRepository.findDeviceById(computer.id)165 foundDevice shouldBe updatedComputer166 }167 @Test168 fun `create, then replace Display, findDeviceById should return updated values`() {169 // given170 deviceRepository.createDevice(display)171 flushAndClear()172 val updatedDisplay = display.copy(173 name = "deskscreen-0815",174 resolution = Resolution.HD175 )176 // when177 deviceRepository.replaceDevice(updatedDisplay)178 flushAndClear()179 // then180 val foundDevice = deviceRepository.findDeviceById(display.id)181 foundDevice shouldBe updatedDisplay182 }183 @Test184 fun `replace unknown device should throw Exception`() {185 // given186 // empty database187 // when/then188 shouldThrow<DeviceNotFoundException> {189 deviceRepository.replaceDevice(display.copy(id = "unknown-id"))190 }191 }192 @Test193 fun `create two Devices, findAllDevices should find both Devices`() {194 // given195 deviceRepository.createDevice(computer)196 deviceRepository.createDevice(display)197 flushAndClear()198 // when199 val foundDevices = deviceRepository.findAllDevices()200 // then201 foundDevices should containExactlyInAnyOrder(computer, display)202 }203 @Test204 fun `in empty database, findAllDevices should return empty list`() {205 // given206 // empty database207 // when208 val foundDevices = deviceRepository.findAllDevices()209 // then210 foundDevices should beEmpty()211 }212 @Test213 // allow catching TransactionException from repository transaction214 // alternative: run non-transactional, that is, outside a @DataJpaTest or @Transactional-annotated class215 @Transactional(propagation = Propagation.SUPPORTS)...

Full Screen

Full Screen

ParallelStatesTest.kt

Source:ParallelStatesTest.kt Github

copy

Full Screen

1package ru.nsk.kstatemachine2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.core.spec.style.StringSpec4import io.kotest.matchers.booleans.shouldBeTrue5import io.kotest.matchers.collections.containExactlyInAnyOrder6import io.kotest.matchers.should7import io.kotest.matchers.shouldBe8import io.mockk.verify9import io.mockk.verifySequence10class ParallelStatesTest : StringSpec({11 "initial state in parallel mode negative" {12 createStateMachine {13 initialState(childMode = ChildMode.PARALLEL) {14 shouldThrow<IllegalStateException> { initialState() }15 }16 }17 }18 "final state in parallel mode negative" {19 createStateMachine(childMode = ChildMode.PARALLEL) {20 shouldThrow<IllegalArgumentException> {21 finalState()22 }23 }24 }25 "parallel state machine" {26 val callbacks = mockkCallbacks()27 lateinit var state1: State28 lateinit var state2: State29 val machine = createStateMachine(childMode = ChildMode.PARALLEL) {30 callbacks.listen(this)31 state1 = state { callbacks.listen(this) }32 state2 = state { callbacks.listen(this) }33 }34 verifySequence {35 callbacks.onEntryState(machine)36 callbacks.onEntryState(state1)37 callbacks.onEntryState(state2)38 }39 machine.activeStates() should containExactlyInAnyOrder(machine, state1, state2)40 machine.isActive.shouldBeTrue()41 state1.isActive.shouldBeTrue()42 state2.isActive.shouldBeTrue()43 }44 "enter parallel states" {45 val callbacks = mockkCallbacks()46 lateinit var state1: State47 lateinit var state11: State48 lateinit var state12: State49 lateinit var state111: State50 val machine = createStateMachine {51 state1 = initialState(childMode = ChildMode.PARALLEL) {52 callbacks.listen(this)53 state11 = state {54 callbacks.listen(this)55 state111 = initialState { callbacks.listen(this) }56 }57 state12 = state { callbacks.listen(this) }58 }59 }60 verifySequence {61 callbacks.onEntryState(state1)62 callbacks.onEntryState(state11)63 callbacks.onEntryState(state111)64 callbacks.onEntryState(state12)65 }66 machine.activeStates() should containExactlyInAnyOrder(machine, state1, state11, state12, state111)67 }68 "exit parallel states" {69 val callbacks = mockkCallbacks()70 lateinit var state1: State71 lateinit var state2: State72 lateinit var state11: State73 lateinit var state12: State74 val machine = createStateMachine {75 state1 = initialState("state1", childMode = ChildMode.PARALLEL) {76 callbacks.listen(this)77 state11 = state("state11") { callbacks.listen(this) }78 state12 = state("state12") { callbacks.listen(this) }79 transitionOn<SwitchEvent> { targetState = { state2 } }80 }...

Full Screen

Full Screen

ApiV1Test.kt

Source:ApiV1Test.kt Github

copy

Full Screen

2import io.andrewohara.cheetosbros.*3import io.andrewohara.cheetosbros.games.withHost4import io.kotest.matchers.be5import io.kotest.matchers.collections.containExactly6import io.kotest.matchers.collections.containExactlyInAnyOrder7import io.kotest.matchers.nulls.shouldNotBeNull8import io.kotest.matchers.shouldBe9import org.http4k.core.*10import org.http4k.kotest.shouldHaveBody11import org.http4k.kotest.shouldHaveStatus12import org.junit.jupiter.api.Test13class ApiV1Test {14 private val driver = TestDriver()15 private val userId = "1337"16 private val friendId = "9001"17 private fun Request.asUser(id: String) = header("Authorization", "Bearer $id")18 @Test19 fun `list games - unauthorized`() {20 val request = Request(Method.GET, "/v1/games")21 driver(request) shouldHaveStatus Status.UNAUTHORIZED22 }23 @Test24 fun `list games`() {25 val created = driver.createGame(userId, me3Data, me3AchievementData, emptyList())26 val response = Request(Method.GET, "/v1/games")27 .asUser(userId)28 .let(driver)29 response shouldHaveStatus Status.OK30 response.shouldHaveBody(ApiV1.Lenses.gamesList, containExactly(created.game.toDtoV1().withImageHost(testCdnHost)))31 }32 @Test33 fun `list achievements`() {34 val created = driver.createGame(userId, me3Data, me3AchievementData, emptyList())35 val response = Request(Method.GET, "/v1/games/${created.game.id}/achievements")36 .asUser(userId)37 .let(driver)38 response shouldHaveStatus Status.OK39 response.shouldHaveBody(ApiV1.Lenses.achievementList, containExactlyInAnyOrder(created.achievements.toDtoV1s().withImageHost(testCdnHost)))40 }41 @Test42 fun `get user - not available`() {43 val response = Request(Method.GET, "/v1/user")44 .asUser(userId)45 .let(driver)46 response shouldHaveStatus Status.NO_CONTENT47 }48 @Test49 fun `get user`() {50 val user = driver.steam.createUser("xxCheetoHunter420xx", avatar = Uri.of("https://slayer.jpg"))51 val response = Request(Method.GET, "/v1/user")52 .asUser(user.id)53 .let(driver)54 response shouldHaveStatus Status.OK55 response.shouldHaveBody(ApiV1.Lenses.user, be(user.toDtoV1()))56 }57 @Test58 fun `set game favourite - not found`() {59 Request(Method.PUT, "/v1/games/${godOfWarData.id}")60 .with(ApiV1.Lenses.updateGame of UpdateGameRequestV1(favourite = true))61 .asUser(userId)62 .let(driver)63 .shouldHaveStatus(Status.NOT_FOUND)64 }65 @Test66 fun `set game favourite`() {67 driver.createGame(userId, godOfWarData, emptyList(), emptyList())68 val response = Request(Method.PUT, "/v1/games/${godOfWarData.id}")69 .with(ApiV1.Lenses.updateGame of UpdateGameRequestV1(favourite = true))70 .asUser(userId)71 .let(driver)72 response shouldHaveStatus Status.OK73 ApiV1.Lenses.game(response).favourite shouldBe true74 driver.gamesDao[userId, godOfWarData.id].shouldNotBeNull()75 .favourite shouldBe true76 }77 @Test78 fun `set achievement favourite - not found`() {79 driver.createGame(userId, godOfWarData, emptyList(), emptyList())80 Request(Method.PUT, "/v1/games/${godOfWarData.id}/achievements/${godOfWarAchievement1Data.id}")81 .with(ApiV1.Lenses.updateGame of UpdateGameRequestV1(favourite = true))82 .asUser(userId)83 .let(driver)84 .shouldHaveStatus(Status.NOT_FOUND)85 }86 @Test87 fun `set achievement favourite`() {88 driver.createGame(userId, godOfWarData, listOf(godOfWarAchievement1Data), emptyList())89 val response = Request(Method.PUT, "/v1/games/${godOfWarData.id}/achievements/${godOfWarAchievement1Data.id}")90 .with(ApiV1.Lenses.updateGame of UpdateGameRequestV1(favourite = true))91 .asUser(userId)92 .let(driver)93 response shouldHaveStatus Status.OK94 ApiV1.Lenses.achievement(response).favourite shouldBe true95 driver.achievementsDao[userId, godOfWarData.id, godOfWarAchievement1Data.id].shouldNotBeNull()96 .favourite shouldBe true97 }98 @Test99 fun `get friends`() {100 val friend1 = driver.steam.createUser("tom")101 val friend2 = driver.steam.createUser("hank")102 driver.steam.addFriend(userId.toLong(), friendId = friend1.id.toLong())103 driver.steam.addFriend(userId.toLong(), friendId = friend2.id.toLong())104 val response = Request(Method.GET, "/v1/friends")105 .asUser(userId)106 .let(driver)107 response shouldHaveStatus Status.OK108 response.shouldHaveBody(ApiV1.Lenses.users, containExactlyInAnyOrder(109 friend1.toDtoV1(), friend2.toDtoV1()110 ))111 }112 @Test113 fun `get achievements for friend`() {114 driver.steam += godOfWarData115 driver.steam += godOfWarAchievement1Data116 driver.steam += godOfWarAchievement2Data117 driver.steam.unlockAchievement(friendId, godOfWarAchievement2Data, tNow)118 val response = Request(Method.GET, "/v1/games/${godOfWarData.id}/friends/$friendId/achievements")119 .asUser(userId)120 .let(driver)121 response shouldHaveStatus Status.OK122 response.shouldHaveBody(ApiV1.Lenses.achievementStatusList, containExactlyInAnyOrder(123 AchievementStatusDtoV1(id = godOfWarAchievement1Data.id, unlockedOn = null, unlocked = false),124 AchievementStatusDtoV1(id = godOfWarAchievement2Data.id, unlockedOn = tNow, unlocked = true)125 ))126 }127 private fun Collection<AchievementDtoV1>.withImageHost(host: Uri) = map {128 it.copy(129 iconLocked = Uri.of(it.iconLocked).withHost(host).toString(),130 iconUnlocked = Uri.of(it.iconUnlocked).withHost(host).toString()131 )132 }133 private fun GameDtoV1.withImageHost(host: Uri) = copy(134 displayImage = Uri.of(displayImage).withHost(host).toString()135 )136}...

Full Screen

Full Screen

PolygonApiTests.kt

Source:PolygonApiTests.kt Github

copy

Full Screen

1package polygon2import io.kotest.core.spec.style.BehaviorSpec3import io.kotest.inspectors.forAll4import io.kotest.koin.KoinListener5import io.kotest.matchers.collections.containExactlyInAnyOrder6import io.kotest.matchers.collections.shouldBeEmpty7import io.kotest.matchers.nulls.shouldBeNull8import io.kotest.matchers.nulls.shouldNotBeNull9import io.kotest.matchers.should10import io.kotest.matchers.shouldBe11import org.koin.test.KoinTest12import org.koin.test.inject13import polygon.TestProblems.problemWithOnlyReadAccess14import polygon.TestProblems.problemWithTestGroups15import polygon.TestProblems.problemWithTestGroupsExceptSamples16import polygon.TestProblems.problemWithoutPdfStatement17import polygon.api.PolygonApi18import polygon.api.TestGroup.PointsPolicyType.COMPLETE_GROUP19import polygon.api.TestGroup.PointsPolicyType.EACH_TEST20import polygonModule21class PolygonApiTests : BehaviorSpec(), KoinTest {22 private val api: PolygonApi by inject()23 override fun listeners() = listOf(KoinListener(polygonModule))24 init {25 Given("getTestGroup") {26 When("asking for problem with test group on all tests") {27 suspend fun result() = api.getTestGroup(problemWithTestGroups).extract()28 val expectedGroups = listOf("samples", "first", "second", "third", "fourth", "fifth")29 Then("returns correct group names") {30 result().map { it.name } should containExactlyInAnyOrder(expectedGroups)31 }32 Then("returns correct group dependencies") {33 val byName = result().associateBy { it.name }34 byName["second"].shouldNotBeNull().dependencies should containExactlyInAnyOrder("samples")35 byName["third"].shouldNotBeNull().dependencies should containExactlyInAnyOrder("first", "fifth")36 byName["fourth"].shouldNotBeNull().dependencies should containExactlyInAnyOrder("third")37 (expectedGroups - setOf("second", "third", "fourth")).forAll {38 byName[it].shouldNotBeNull().dependencies.shouldBeEmpty()39 }40 }41 Then("all groups except fourth should have points policy of EACH_TEST") {42 val result = result().associateBy { it.name }43 result.entries.filter { it.key != "fourth" }.map { it.value }44 .forAll { it.pointsPolicy shouldBe EACH_TEST }45 result["fourth"].shouldNotBeNull().pointsPolicy shouldBe COMPLETE_GROUP46 }47 Then("fourth group should have points policy of COMPLETE_GROUP") {48 result().single { it.name == "fourth" }.pointsPolicy shouldBe COMPLETE_GROUP49 }50 }51 When("asking for problem with test group on all tests except samples") {52 suspend fun result() = api.getTestGroup(problemWithTestGroupsExceptSamples).extract()53 val expectedGroups = listOf("first", "second", "third", "fourth", "fifth")54 Then("returns correct group names") {55 result().map { it.name } should containExactlyInAnyOrder(expectedGroups)56 }57 Then("returns correct group dependencies") {58 val byName = result().associateBy { it.name }59 byName["third"].shouldNotBeNull().dependencies should containExactlyInAnyOrder("first", "fifth")60 byName["fourth"].shouldNotBeNull().dependencies should containExactlyInAnyOrder("third")61 (expectedGroups - setOf("third", "fourth")).forAll {62 byName[it].shouldNotBeNull().dependencies.shouldBeEmpty()63 }64 }65 Then("all groups except fourth should have points policy of EACH_TEST") {66 val result = result().associateBy { it.name }67 result.entries.filter { it.key != "fourth" }.map { it.value }68 .forAll { it.pointsPolicy shouldBe EACH_TEST }69 result["fourth"].shouldNotBeNull().pointsPolicy shouldBe COMPLETE_GROUP70 }71 Then("fourth group should have points policy of COMPLETE_GROUP") {72 result().single { it.name == "fourth" }.pointsPolicy shouldBe COMPLETE_GROUP73 }74 }...

Full Screen

Full Screen

CurrencyTest.kt

Source:CurrencyTest.kt Github

copy

Full Screen

1package dev.itbasis.kochange.core.currency2import io.kotest.core.spec.style.DescribeSpec3import io.kotest.datatest.withData4import io.kotest.matchers.collections.containExactlyInAnyOrder5import io.kotest.matchers.collections.shouldHaveSize6import io.kotest.matchers.maps.shouldHaveSize7import io.kotest.matchers.should8import io.kotest.matchers.shouldBe9import io.kotest.matchers.shouldNotBe10internal class CurrencyTest : DescribeSpec() {11 init {12 afterTest {13 Currency.resetCache()14 }15 describe("currency count") {16 it("every symbol") {17 withData(18 Pair("A", 29),19 Pair("B", 37),20 Pair("C", 26),21 Pair("D", 19),22 Pair("E", 16),23 Pair("F", 9),24 Pair("G", 14),25 Pair("H", 0),26 Pair("I", 0),27 Pair("J", 4),28 Pair("K", 2),29 Pair("L", 4),30 Pair("M", 11),31 Pair("N", 4),32 Pair("O", 5),33 Pair("P", 2),34 Pair("Q", 3),35 Pair("R", 3),36 Pair("S", 12),37 Pair("T", 2),38 Pair("U", 14),39 Pair("V", 2),40 Pair("W", 3),41 Pair("X", 8),42 Pair("Y", 3),43 Pair("Z", 3)44 ) { (prefix, count) ->45 currencies.filterKeys {46 it.startsWith(prefix = prefix)47 }.keys.shouldHaveSize(count)48 }49 }50 it("total") {51 currencies.shouldHaveSize(235)52 Currency.all().shouldHaveSize(233)53 }54 }55 describe("alternative codes") {56 withData(57 Triple(BTC, XBT, listOf("XBT")),58 Triple(XBT, BTC, listOf("BTC"))59 ) { (currency, equal, alternatives) ->60 currency.alternativeCodes should containExactlyInAnyOrder(alternatives)61 currency shouldBe equal62 }63 }64 describe("create new instance") {65 val nnn = Currency.getOrCreateInstance(code = "NNN", baseCurrency = XBT)66 nnn.code shouldBe "NNN"67 nnn.name shouldBe BTC.name68 nnn.alternativesAsInstances() should containExactlyInAnyOrder(BTC, XBT)69 nnn shouldBe BTC70 nnn shouldBe XBT71 val nnn1 = Currency.getOrCreateInstance(code = "NNN")72 nnn1.code shouldBe "NNN"73 nnn1.name shouldBe BTC.name74 nnn1.alternativesAsInstances() should containExactlyInAnyOrder(BTC, XBT)75 nnn1 shouldBe BTC76 nnn1 shouldBe XBT77 val nnn2 = Currency.getOrCreateInstance(code = "NNN", baseCurrency = LTC)78 nnn2.code shouldBe "NNN"79 nnn2.name shouldBe BTC.name80 nnn2.alternativesAsInstances() should containExactlyInAnyOrder(BTC, XBT)81 nnn2 shouldBe BTC82 nnn2 shouldBe XBT83 }84 describe("get instance not create") {85 it("exists") {86 data class TestData(87 val code: String,88 val expectCurrency: Currency,89 val expectName: String,90 val expectAlternatives: List<String> = emptyList()91 )92 withData(93 nameFn = { t: TestData -> "${t.code} -> ${t.expectCurrency}" },94 TestData(code = "BTC", expectCurrency = BTC, expectName = "Bitcoin", expectAlternatives = listOf("XBT")),95 TestData(code = "XBT", expectCurrency = XBT, expectName = "Bitcoin", expectAlternatives = listOf("BTC")),96 TestData(code = "AED", expectCurrency = AED, expectName = "United Arab Emirates Dirham"),97 TestData(code = "BRL", expectCurrency = BRL, expectName = "Brazilian Real", expectAlternatives = listOf("R$")),98 TestData(code = "R$", expectCurrency = BRL, expectName = "Brazilian Real", expectAlternatives = listOf("R$")),99 TestData(code = "COTI", expectCurrency = COTI, expectName = "COTI")100 ) { (code, expectCurrency, expectName, expectAlternatives) ->101 val actual = Currency.getInstanceNotCreate(code = code)102 requireNotNull(actual)103 actual shouldBe expectCurrency104 actual.name shouldBe expectName105 actual.alternativeCodes should containExactlyInAnyOrder(expectAlternatives)106 }107 withData(108 Pair("BTC", BTC),109 Pair("btc", null),110 Pair("Btc", null),111 Pair("bTc", null),112 Pair("R$", BRL),113 Pair("r$", null),114 Pair("GHS", GHS),115// Pair("GHs", GHs),116 Pair("gHs", null)117 ) { (code, currency) ->118 Currency.getInstanceNotCreate(code = code) shouldBe currency119 }...

Full Screen

Full Screen

PreviewViewModelSpec.kt

Source:PreviewViewModelSpec.kt Github

copy

Full Screen

1package net.subroh0508.colormaster.presentation.preview.spec2import io.kotest.core.test.TestCase3import io.kotest.matchers.be4import io.kotest.matchers.collections.beEmpty5import io.kotest.matchers.collections.containExactlyInAnyOrder6import io.kotest.matchers.collections.haveSize7import io.kotest.matchers.nulls.beNull8import io.kotest.matchers.should9import kotlinx.coroutines.flow.launchIn10import kotlinx.coroutines.flow.onEach11import net.subroh0508.colormaster.model.*12import net.subroh0508.colormaster.presentation.preview.MockIdolColorsRepository13import net.subroh0508.colormaster.presentation.preview.mockSearch14import net.subroh0508.colormaster.presentation.preview.model.FullscreenPreviewUiModel15import net.subroh0508.colormaster.presentation.preview.viewmodel.PreviewViewModel16import net.subroh0508.colormaster.test.TestScope17import net.subroh0508.colormaster.test.ViewModelSpec18class PreviewViewModelSpec : ViewModelSpec() {19 private val observedUiModels: MutableList<FullscreenPreviewUiModel> = mutableListOf()20 private val repository = MockIdolColorsRepository()21 lateinit var viewModel: PreviewViewModel22 override fun beforeTest(testCase: TestCase) {23 super.beforeTest(testCase)24 viewModel = PreviewViewModel(repository, TestScope()/* for JS Runtime */)25 observedUiModels.clear()26 viewModel.uiModel.onEach { observedUiModels.add(it) }27 .launchIn(TestScope())28 }29 private fun subject(block: () -> Unit): List<FullscreenPreviewUiModel> {30 block()31 return observedUiModels32 }33 init {34 val idols = listOf(35 IdolColor("Mitsumine_Yuika", "三峰結華", HexColor("3B91C4")),36 IdolColor("Hayami_Kanade", "速水奏", HexColor("0D386D")),37 )38 test("#fetch: when repository#search returns idols colors it should post FullscreenPreviewUiModel with filled list") {39 repository.mockSearch(idols.map(IdolColor::id)) { idols }40 subject { viewModel.fetch(idols.map(IdolColor::id)) }.also { models ->41 models should haveSize(3)42 models[0] should {43 it.items should beEmpty()44 it.error should beNull()45 it.isLoading should be(false)46 }47 models[1] should {48 it.items should beEmpty()49 it.error should beNull()50 it.isLoading should be(true)51 }52 models[2] should {53 it.items should containExactlyInAnyOrder(idols)54 it.error should beNull()55 it.isLoading should be(false)56 }57 }58 }59 test("#fetch: when repository#search raises Exception it should post FullscreenPreviewUiModel with empty list") {60 val error = IllegalStateException()61 repository.mockSearch(idols.map(IdolColor::id)) { throw error }62 subject { viewModel.fetch(idols.map(IdolColor::id)) }.also { models ->63 models should haveSize(3)64 models[0] should {65 it.items should beEmpty()66 it.error should beNull()67 it.isLoading should be(false)...

Full Screen

Full Screen

containExactlyInAnyOrder

Using AI Code Generation

copy

Full Screen

1val list1 = listOf(1, 2, 3, 4, 5)2val list2 = listOf(3, 2, 1, 5, 4)3list1 should containExactlyInAnyOrder(list2)4val list1 = listOf(1, 2, 3, 4, 5)5val list2 = listOf(3, 2, 1, 5, 4)6list1 should containExactlyInAnyOrder(list2)7val list1 = listOf(1, 2, 3, 4, 5)8val list2 = listOf(3, 2, 1, 5, 4)9list1 should containExactlyInAnyOrder(list2)10val list1 = listOf(1, 2, 3, 4, 5)11val list2 = listOf(3, 2, 1, 5, 4)12list1 should containExactlyInAnyOrder(list2)13val list1 = listOf(1, 2, 3, 4, 5)14val list2 = listOf(3, 2, 1, 5, 4)15list1 should containExactlyInAnyOrder(list2)16val list1 = listOf(1, 2, 3, 4, 5)17val list2 = listOf(3, 2, 1, 5, 4)18list1 should containExactlyInAnyOrder(list2)19val list1 = listOf(1, 2, 3, 4, 5)20val list2 = listOf(3, 2, 1, 5, 4)21list1 should containExactlyInAnyOrder(list2)

Full Screen

Full Screen

containExactlyInAnyOrder

Using AI Code Generation

copy

Full Screen

1val actualList = listOf(1, 2, 3, 4, 5)2actualList should containExactlyInAnyOrder(5, 4, 3, 2, 1)3val actualList = listOf(1, 2, 3, 4, 5)4val actualList = listOf(1, 2, 3, 4, 5)5actualList shouldNotContainAll listOf(6, 7, 8)6val actualList = listOf(1, 2, 3, 4, 5)7val actualList = listOf(1, 2, 3, 4, 5)8actualList shouldNotContainExactly listOf(6, 7, 8)9val actualList = listOf(1, 2, 3, 4, 5)10actualList shouldNotContainExactlyInAnyOrder listOf(6, 7, 8)11val actualList = listOf(1, 2, 3, 4, 5)12val actualList = listOf(1, 2, 3, 4, 5)13actualList shouldNotContainInOrder listOf(2, 3, 4)14val actualList = listOf(1, 2, 3, 4, 5)15actualList shouldNotContainInOrderOnly listOf(2, 3, 4)16val actualList = listOf(1,

Full Screen

Full Screen

containExactlyInAnyOrder

Using AI Code Generation

copy

Full Screen

1fun `should contain only the provided elements in any order`() {2 val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)3 list should containExactlyInAnyOrder(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)4}5fun `should contain only the provided elements in any order using vararg`() {6 val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)7 list should containExactlyInAnyOrder(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)8}9fun `should contain only the provided elements in any order using array`() {10 val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)11 list should containExactlyInAnyOrder(arrayOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))12}13fun `should contain only the provided elements in any order using iterable`() {14 val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)15 list should containExactlyInAnyOrder(listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))16}17fun `should contain only the provided elements in any order using sequence`() {18 val list = listOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)19 list should containExactlyInAnyOrder(sequenceOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))20}21fun `should contain only the provided elements in any order using collection`() {22 val list = listOf(1, 2,

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 containExactlyInAnyOrder

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful