How to use beEmpty method of io.kotest.matchers.maps.matchers class

Best Kotest code snippet using io.kotest.matchers.maps.matchers.beEmpty

JMeterBaseTaskTest.kt

Source:JMeterBaseTaskTest.kt Github

copy

Full Screen

...6import io.kotest.matchers.collections.contain7import io.kotest.matchers.collections.shouldContain8import io.kotest.matchers.collections.shouldHaveSize9import io.kotest.matchers.collections.shouldNotContain10import io.kotest.matchers.maps.beEmpty11import io.kotest.matchers.maps.haveSize12import io.kotest.matchers.maps.shouldHaveSize13import io.kotest.matchers.should14import io.kotest.matchers.shouldBe15import io.kotest.matchers.shouldHave16import io.kotest.matchers.shouldNot17import io.kotest.matchers.string.match18import org.junit.jupiter.api.Test19import org.junit.jupiter.api.assertAll20import org.junit.jupiter.api.assertThrows21import java.io.File22class JMeterBaseTaskTest : JMeterTaskTestBase() {23 //<editor-fold desc="Sys-prop-file">24 @Test25 fun systemPropertyFileDefaultsToEmpty() {26 val task = createTask<JMeterBaseTask> {}.get()27 task.jmSystemPropertyFiles.isEmpty shouldBe true28 }29 @Test30 fun taskMustInheritSystemPropertyFile() {31 val task = createTask<JMeterBaseTask> {32 systemPropertyFiles.from(project.file("testSysProps.properties"))33 }.get()34 task.jmSystemPropertyFiles shouldContain project.file("testSysProps.properties")35 }36 @Test37 fun systemPropertyFileMustPutToRunArguments() {38 val task = createTask<JMeterBaseTask> {39 systemPropertyFiles.from(project.file("sysPropsForArgs.properties"))40 }.get()41 val result = task.createRunArguments()42 result shouldHave entryEndsWith("sysPropsForArgs.properties")43 }44 //</editor-fold>45 //<editor-fold desc="Sys prop key value">46 @Test47 fun systemPropertyDefaultsToEmpty() {48 val task = createTask<JMeterBaseTask> {}.get()49 task.jmSystemProperties.get() should beEmpty()50 }51 @Test52 fun taskMustInheritSystemProperty() {53 val task = createTask<JMeterBaseTask> {54 systemProperties.put("sysKey", "sysVal")55 }.get()56 assertAll(57 { task.jmSystemProperties.get() shouldHaveSize 1 },58 { task.jmSystemProperties.get() should io.kotest.matchers.maps.contain("sysKey", "sysVal") }59 )60 }61 @Test62 fun inheritSystemPropertyCanBeExtended() {63 val task = createTaskWithConfig<JMeterBaseTask>({64 systemProperties.put("sysKey1", "sysVal1")65 }, {66 jmSystemProperties.put("sysKey2", "sysVal2")67 }).get()68 assertAll(69 { task.jmSystemProperties.get() shouldHaveSize 2 },70 { task.jmSystemProperties.get() should io.kotest.matchers.maps.contain("sysKey1", "sysVal1") },71 { task.jmSystemProperties.get() should io.kotest.matchers.maps.contain("sysKey2", "sysVal2") }72 )73 }74 @Test75 fun systemPropertiesMustPutToRunArguments() {76 val task = createTask<JMeterBaseTask> {77 systemProperties.put("aKey", "aValue")78 }.get()79 val result = task.createRunArguments()80 result should contain("-DaKey=aValue")81 }82 @Test83 fun multipleSystemPropertiesMustPutToRunArguments() {84 val task = createTaskWithConfig<JMeterBaseTask>({ }, {85 jmSystemProperties.put("bKey1", "bValue1")86 jmSystemProperties.put("bKey2", "bValue2")87 }).get()88 val result = task.createRunArguments()89 assertAll(90 { result should contain("-DbKey1=bValue1") },91 { result should contain("-DbKey2=bValue2") }92 )93 }94 //</editor-fold>95 //<editor-fold desc="Main property file">96 @Test97 fun mainPropertyFileDefaultsToUnset() {98 val task = createTask<JMeterBaseTask> { }.get()99 task.mainPropertyFile.isPresent shouldBe false100 }101 @Test102 fun taskMustInheritMainPropertyFile() {103 val task = createTask<JMeterBaseTask> {104 mainPropertyFile.set(project.file("main.properties"))105 }.get()106 task.mainPropertyFile.get().asFile shouldBe project.file("main.properties")107 }108 @Test109 fun mainPropertyFileMustPutToRunArguments() {110 val task = createTask<JMeterBaseTask> {111 mainPropertyFile.set(project.file("otherMain.properties"))112 }.get()113 val result = task.createRunArguments()114 result shouldHave entryEndsWith("otherMain.properties")115 }116 //</editor-fold>117 //<editor-fold desc="Additional prop files">118 @Test119 fun additionalPropertyFilesDefaultsToEmpty() {120 val task = createTask<JMeterBaseTask> { }.get()121 withClue("Should be empty") { task.additionalPropertyFiles.isEmpty shouldBe true }122 }123 @Test124 fun taskMustInheritAdditionalPropertyFiles() {125 val task = createTask<JMeterBaseTask> {126 additionalPropertyFiles.from(project.file("addProp.properties"))127 }.get()128 assertAll(129 { task.additionalPropertyFiles.files shouldHaveSize (1) },130 { task.additionalPropertyFiles.files should contain(project.file("addProp.properties")) }131 )132 }133 @Test134 fun extendAdditionalPropertyFilesInTaskDoesNotAffectExtension() {135 val task = createTaskWithConfig<JMeterBaseTask>({136 additionalPropertyFiles.from(137 "Extension.file"138 )139 }, {140 additionalPropertyFiles.from("Task.file")141 }).get()142 val proj = task.project143 val ext = proj.extensions.getByType(JMeterExtension::class.java)144 assertAll(145 { withClue("Ext: ") { ext.additionalPropertyFiles shouldContain proj.file("Extension.file") } },146 { withClue("Ext: ") { ext.additionalPropertyFiles shouldNotContain proj.file("Task.file") } },147 { withClue("Task: ") { task.additionalPropertyFiles shouldContain proj.file("Extension.file") } },148 { withClue("Task: ") { task.additionalPropertyFiles shouldContain proj.file("Task.file") } }149 )150 }151 @Test152 fun additionalPropertyFilesMustPutToRunArguments() {153 val task = createTask<JMeterBaseTask> {154 additionalPropertyFiles.from(155 "Extension.file"156 )157 }.get()158 val result = task.createRunArguments()159 assertAll(160 { result shouldContain "-q" },161 { result shouldHave entryEndsWith("Extension.file") }162 )163 }164 //</editor-fold>165 //<editor-fold desc="jmeter Properties">166 @Test167 fun jmeterPropertiesDefaultsToEmpty() {168 val task = createTask<JMeterBaseTask> { }.get()169 task.jmeterProperties.get() should beEmpty()170 }171 @Test172 fun taskMustInheritJmeterProperties() {173 val task = createTask<JMeterBaseTask> {174 jmeterProperties.put("jmpExtKey", "jmpExtVal")175 }.get()176 assertAll(177 { task.jmeterProperties.get() should haveSize(1) },178 { task.jmeterProperties.get() should io.kotest.matchers.maps.contain("jmpExtKey", "jmpExtVal") }179 )180 }181 @Test182 fun inheritedJmeterPropertiesCanBeExtended() {183 val task = createTaskWithConfig<JMeterBaseTask>({...

Full Screen

Full Screen

DeclaredLicenseProcessorTest.kt

Source:DeclaredLicenseProcessorTest.kt Github

copy

Full Screen

...20import io.kotest.assertions.throwables.shouldNotThrow21import io.kotest.assertions.withClue22import io.kotest.core.spec.style.StringSpec23import io.kotest.inspectors.forAll24import io.kotest.matchers.collections.beEmpty25import io.kotest.matchers.collections.containExactly26import io.kotest.matchers.maps.beEmpty as beEmptyMap27import io.kotest.matchers.maps.containExactly as containExactlyEntries28import io.kotest.matchers.maps.shouldContainExactly29import io.kotest.matchers.nulls.beNull30import io.kotest.matchers.should31import io.kotest.matchers.shouldBe32import io.kotest.matchers.shouldNotBe33import org.ossreviewtoolkit.utils.spdx.SpdxConstants34import org.ossreviewtoolkit.utils.spdx.SpdxDeclaredLicenseMapping35import org.ossreviewtoolkit.utils.spdx.SpdxException36import org.ossreviewtoolkit.utils.spdx.SpdxExpression37import org.ossreviewtoolkit.utils.spdx.SpdxLicense38import org.ossreviewtoolkit.utils.spdx.SpdxLicenseIdExpression39import org.ossreviewtoolkit.utils.spdx.SpdxSimpleLicenseMapping40import org.ossreviewtoolkit.utils.spdx.toExpression41import org.ossreviewtoolkit.utils.spdx.toSpdx42import org.ossreviewtoolkit.utils.test.shouldNotBeNull43class DeclaredLicenseProcessorTest : StringSpec() {44 /**45 * A collection of declared license strings found in open source packages.46 */47 private val declaredLicenses = SpdxSimpleLicenseMapping.mapping.keys + SpdxDeclaredLicenseMapping.mapping.keys48 init {49 "Declared licenses can be processed" {50 declaredLicenses.forAll { declaredLicense ->51 val processedLicense = DeclaredLicenseProcessor.process(declaredLicense)52 // Include the declared license in the comparison to see where a failure comes from.53 "$processedLicense from $declaredLicense" shouldNotBe "null from $declaredLicense"54 processedLicense!!.validate(SpdxExpression.Strictness.ALLOW_CURRENT)55 }56 }57 "Mapped licenses are de-duplicated" {58 val declaredLicenses = setOf("Apache2", "Apache-2")59 val processedLicenses = DeclaredLicenseProcessor.process(declaredLicenses)60 processedLicenses.spdxExpression shouldBe SpdxLicenseIdExpression("Apache-2.0")61 processedLicenses.mapped should containExactlyEntries(62 "Apache2" to SpdxLicense.APACHE_2_0.toExpression() as SpdxExpression,63 "Apache-2" to SpdxLicense.APACHE_2_0.toExpression() as SpdxExpression64 )65 processedLicenses.unmapped should beEmpty()66 }67 "Licenses are not mapped to deprecated SPDX licenses" {68 declaredLicenses.forAll { declaredLicense ->69 val processedLicense = DeclaredLicenseProcessor.process(declaredLicense)70 processedLicense shouldNotBeNull {71 shouldNotThrow<SpdxException> {72 validate(SpdxExpression.Strictness.ALLOW_CURRENT)73 }74 }75 }76 }77 "Prefixes and suffixes are removed from the license" {78 val processedLicense = DeclaredLicenseProcessor.process(79 "https://choosealicense.com/licenses/apache-2.0.txt"80 )81 processedLicense shouldBe SpdxLicenseIdExpression("Apache-2.0")82 }83 "Stripping URL surroundings should not make any mapping redundant" {84 SpdxDeclaredLicenseMapping.mapping.forAll { (license, expression) ->85 val strippedLicense = DeclaredLicenseProcessor.stripUrlSurroundings(license)86 withClue("Stripping '$license' to '$strippedLicense' makes the mapping to '$expression' redundant") {87 SpdxSimpleLicenseMapping.map(strippedLicense) should beNull()88 }89 }90 }91 "The SPDX expression only contains valid licenses" {92 val declaredLicenses = setOf("Apache-2.0", "invalid")93 val processedLicenses = DeclaredLicenseProcessor.process(declaredLicenses)94 processedLicenses.spdxExpression shouldBe SpdxLicenseIdExpression("Apache-2.0")95 processedLicenses.mapped should beEmptyMap()96 processedLicenses.unmapped should containExactly("invalid")97 }98 "Processing a compound SPDX expression should result in the same expression" {99 val declaredLicenses = setOf("Apache-2.0 AND LicenseRef-Proprietary")100 val processedLicenses = DeclaredLicenseProcessor.process(declaredLicenses)101 processedLicenses.spdxExpression shouldBe SpdxExpression.parse("Apache-2.0 AND LicenseRef-Proprietary")102 processedLicenses.mapped should beEmptyMap()103 processedLicenses.unmapped should beEmpty()104 }105 "The declared license mapping is applied" {106 val declaredLicenses = setOf("Apache-2.0", "https://domain/path/license.html")107 val declaredLicenseMapping = mapOf("https://domain/path/license.html" to "MIT".toSpdx())108 val processedLicenses = DeclaredLicenseProcessor.process(declaredLicenses, declaredLicenseMapping)109 processedLicenses.spdxExpression shouldBe "Apache-2.0 AND MIT".toSpdx()110 processedLicenses.mapped shouldContainExactly mapOf("https://domain/path/license.html" to "MIT".toSpdx())111 processedLicenses.unmapped should beEmpty()112 }113 "The declared license mapping discards licenses which are mapped to 'NONE' when applied " {114 val declaredLicenses = setOf("Copyright (c) the authors.", "Apache-2.0", "MIT")115 val declaredLicenseMapping = mapOf("Copyright (c) the authors." to SpdxConstants.NONE.toSpdx())116 val processedLicenses = DeclaredLicenseProcessor.process(declaredLicenses, declaredLicenseMapping)117 processedLicenses.spdxExpression shouldBe "Apache-2.0 AND MIT".toSpdx()118 processedLicenses.mapped shouldContainExactly mapOf(119 "Copyright (c) the authors." to SpdxConstants.NONE.toSpdx()120 )121 processedLicenses.unmapped should beEmpty()122 }123 }124}...

Full Screen

Full Screen

KontentTest.kt

Source:KontentTest.kt Github

copy

Full Screen

...16import io.bkbn.kompendium.oas.schema.FormattedSchema17import io.bkbn.kompendium.oas.schema.ObjectSchema18import io.kotest.assertions.throwables.shouldThrow19import io.kotest.core.spec.style.DescribeSpec20import io.kotest.matchers.maps.beEmpty21import io.kotest.matchers.maps.shouldContainKey22import io.kotest.matchers.maps.shouldHaveKey23import io.kotest.matchers.maps.shouldHaveSize24import io.kotest.matchers.should25import io.kotest.matchers.shouldBe26import io.kotest.matchers.shouldNotBe27import java.util.UUID28class KontentTest : DescribeSpec({29 describe("Kontent analysis") {30 it("Can return an empty map when passed Unit") {31 // arrange32 val cache: SchemaMap = mutableMapOf()33 // act34 generateKontent<Unit>(cache)35 // assert36 cache should beEmpty()37 }38 it("Can return a single map result when analyzing a primitive") {39 // arrange40 val cache: SchemaMap = mutableMapOf()41 // act42 generateKontent<Long>(cache)43 // assert44 cache shouldHaveSize 145 cache["Long"] shouldBe FormattedSchema("int64", "integer")46 }47 it("Can handle BigDecimal and BigInteger Types") {48 // arrange49 val cache: SchemaMap = mutableMapOf()50 // act...

Full Screen

Full Screen

KotlinTest.kt

Source:KotlinTest.kt Github

copy

Full Screen

...3import io.kotest.matchers.collections.sorted4import io.kotest.matchers.should5import io.kotest.matchers.shouldBe6import io.kotest.matchers.string.*7import io.kotest.matchers.collections.beEmpty8import io.kotest.matchers.maps.contain9import io.kotest.matchers.maps.haveKey10import io.kotest.matchers.maps.haveValue11class StringSpecTest : StringSpec() {12 // StringSpec를 상속 받으며, 보통 init 블럭 내에서 테스트 코드를 작성한다.13 // init 블록 내부의 문자열은 테스트를 설명하는 부분이며, 블럭 내부의 코드가 실제 테스트가 진행되는 부분이다.14 init {15 "문자열.length가 문자열의 길이를 리턴해야 합니다." {16 "kotlin test".length shouldBe 1117 }18 }19}20class FunSpecTest : FunSpec({21 // FunSpec는 함수 형태로 테스트 코드를 작성할 수 있도록 돕는다.22 // 테스트 함수의 매개 변수는 단순 테스트 설명이며, 테스트 함수 내부의 코드가 실제 테스트가 진행되는 부분이다.23 test("문자열의 길이를 리턴해야 합니다.") {24 "kotlin".length shouldBe 625 "".length shouldBe 026 }27})28class ShouldSpecTest : ShouldSpec({29 // ShouldSpec는 FunSpec과 유사하다. 다만, test 대신 should 키워드를 사용한다는 차이점이 있다.30 // 아래 should 의 매개 변수는 단순 설명이고, 테스트는 역시 블럭 내부에서 동작한다.31 should("문자열의 길이를 리턴해야 합니다.") {32 "kotlin".length shouldBe 633 "".length shouldBe 034 }35})36class WordSpecTest : WordSpec({37 // String.length 부분은 context string이다. 어떠한 환경에서 테스트를 진행할 것인지를 말해 주는 것이다.38 // 아래 한글은 역시 설명 부분이며, 코드 블럭 내부에서 실제 테스트가 동작한다.39 "String.length" should {40 "문자열의 길이를 리턴해야 합니다." {41 "kotlin".length shouldBe 642 "".length shouldBe 043 }44 }45})46class BehaviorSpecTest : BehaviorSpec({47 // BehaviorSpec는 BDD (Behaviour Driven Development)48 given("젓가락") {49 `when`("잡는다.") {50 then("음식을 먹는다.") {51 println("젓가락을 잡고, 음식을 먹는다.")52 }53 }54 `when`("던진다.") {55 then("사람이 맞는다.") {56 println("젓가락을 던지면, 사람이 맞는다.")57 }58 }59 }60})61class AnnotationSpecTest : AnnotationSpec() {62 // AnnotationSpec는 JUnit 스타일(PersonTest 파일 참고)로 테스트 코드를 작성할 수 있다.63 @BeforeEach64 fun beforeTest() {65 println("Before Test, Setting")66 }67 @Test68 fun test1() {69 "test".length shouldBe 470 }71 @Test72 fun test2() {73 "test2".length shouldBe 574 }75}76class MatcherTest : StringSpec() {77 init {78 // shouldBe는 동일함을 체크하는 Matcher 이다.79 "hello World" shouldBe haveLength(11) // length가 매개변수에 전달된 값이어야 함을 체크한다.80 "hello" should include("ll") // 매개변수 값이 포함되어 있는지 확인한다.81 "hello" should endWith("lo") // 매개변수의 끝이 포함되는지 확인한다.82 "hello" should match("he...") // 매개변수가 매칭되는지 체크한다.83 "hello".shouldBeLowerCase() // 소문자로 작성된 것이 맞는지 체크한다.84 val list = emptyList<String>()85 val list2 = listOf("aaa", "bbb", "ccc")86 val map = mapOf<String, String>(Pair("aa", "11"))87 list should beEmpty() // 원소가 비었는지 확인한다.88 list2 shouldBe sorted<String>() // 해당 자료형이 정렬되어 있는지 확인한다.89 map should contain("aa", "11") // 해당 원소가 포함되어 있는지 확인한다.90 map should haveKey("aa") // 해당 키 값이 포함되어 있는지 확인한다.91 map should haveValue("11") // 해당 value 값이 포함되어 있는지 확인한다.92 }93}...

Full Screen

Full Screen

OperatorsTest.kt

Source:OperatorsTest.kt Github

copy

Full Screen

...3import io.kotest.assertions.arrow.option.beNone4import io.kotest.assertions.arrow.option.shouldBeSome5import io.kotest.assertions.assertSoftly6import io.kotest.inspectors.forAll7import io.kotest.matchers.collections.beEmpty8import io.kotest.matchers.maps.shouldBeEmpty9import io.kotest.matchers.should10import io.kotest.matchers.shouldBe11import io.kpeg.ParseError12import io.kpeg.ParserState13import io.kpeg.testutils.OperatorsTestUtils.PtDataCh14import io.kpeg.testutils.OperatorsTestUtils.PtDataLit15import io.kpeg.testutils.OperatorsTestUtils.ptDataBiChCorrectProvider16import io.kpeg.testutils.OperatorsTestUtils.ptDataBiChIncorrectProvider17import io.kpeg.testutils.OperatorsTestUtils.ptDataChCorrectProvider18import io.kpeg.testutils.OperatorsTestUtils.ptDataChIncorrectProvider19import io.kpeg.testutils.OperatorsTestUtils.ptDataLitCorrectProvider20import io.kpeg.testutils.OperatorsTestUtils.ptDataLitIncorrectProvider21import org.junit.jupiter.api.Nested22import org.junit.jupiter.params.ParameterizedTest23import org.junit.jupiter.params.provider.MethodSource24internal class OperatorsTest {25 private lateinit var ps: ParserState26 @Nested27 inner class BuiltIn {28 private fun correctProvider() = ptDataBiChCorrectProvider()29 private fun incorrectProvider() = ptDataBiChIncorrectProvider()30 @ParameterizedTest31 @MethodSource("correctProvider")32 fun `parse 1 built-in in correct string`(data: PtDataCh) {33 ps = ParserState("${data.c}")34 val actualChar = data.pe.parse(ps)35 actualChar shouldBeSome data.c36 assertSoftly(ps) {37 i shouldBe 138 ignoreWS shouldBe false39 memNone.forAll { it.shouldBeEmpty() }40 memSome shouldBe listOf(41 mapOf(data.pe to (1 to Some(data.c))),42 emptyMap(),43 )44 errs should beEmpty()45 }46 }47 @ParameterizedTest48 @MethodSource("incorrectProvider")49 fun `parse 1 built-in in incorrect string`(data: PtDataCh) {50 ps = ParserState("${data.c}")51 val actualChar = data.pe.parse(ps)52 actualChar should beNone()53 assertSoftly(ps) {54 i shouldBe 055 ignoreWS shouldBe false56 memNone shouldBe listOf(57 mapOf(data.pe to listOf(ParseError(index = 0, message = "Wrong Character"))),58 emptyMap(),59 )60 memSome.forAll { it.shouldBeEmpty() }61 errs shouldBe listOf(ParseError(index = 0, message = "Wrong Character"))62 }63 }64 }65 @Nested66 inner class Character {67 private fun correctProvider() = ptDataChCorrectProvider()68 private fun incorrectProvider() = ptDataChIncorrectProvider()69 @ParameterizedTest70 @MethodSource("correctProvider")71 fun `parse 1 char in correct string`(data: PtDataCh) {72 ps = ParserState("${data.c}")73 val actualChar = data.pe.parse(ps)74 actualChar shouldBeSome data.c75 assertSoftly(ps) {76 i shouldBe 177 ignoreWS shouldBe false78 memNone.forAll { it.shouldBeEmpty() }79 memSome.forAll { it.shouldBeEmpty() }80 errs should beEmpty()81 }82 }83 @ParameterizedTest84 @MethodSource("incorrectProvider")85 fun `parse 1 char in incorrect string`(data: PtDataCh) {86 ps = ParserState("${data.c}")87 val actualChar = data.pe.parse(ps)88 actualChar should beNone()89 assertSoftly(ps) {90 i shouldBe 091 ignoreWS shouldBe false92 memNone.forAll { it.shouldBeEmpty() }93 memSome.forAll { it.shouldBeEmpty() }94 errs shouldBe listOf(ParseError(index = 0, message = "Wrong Character"))95 }96 }97 }98 @Nested99 inner class Literal {100 private fun correctProvider() = ptDataLitCorrectProvider()101 private fun incorrectProvider() = ptDataLitIncorrectProvider()102 @ParameterizedTest103 @MethodSource("correctProvider")104 fun `parse 1 literal in correct string`(data: PtDataLit) {105 ps = ParserState(data.l)106 val actualLiteral = data.pe.parse(ps)107 actualLiteral shouldBeSome data.l108 assertSoftly(ps) {109 i shouldBe data.l.length110 ignoreWS shouldBe false111 memNone.forAll { it.shouldBeEmpty() }112 memSome.forAll { it.shouldBeEmpty() }113 errs should beEmpty()114 }115 }116 @ParameterizedTest117 @MethodSource("incorrectProvider")118 fun `parse 1 literal in incorrect string`(data: PtDataLit) {119 ps = ParserState(data.l)120 val actualLiteral = data.pe.parse(ps)121 actualLiteral should beNone()122 assertSoftly(ps) {123 i shouldBe 0124 ignoreWS shouldBe false125 memNone.forAll { it.shouldBeEmpty() }126 memSome.forAll { it.shouldBeEmpty() }127 errs shouldBe listOf(ParseError(index = 0, message = "Wrong Literal"))...

Full Screen

Full Screen

QueryTest.kt

Source:QueryTest.kt Github

copy

Full Screen

1package com.nuglif.kuri2import io.kotest.assertions.assertSoftly3import io.kotest.matchers.maps.beEmpty4import io.kotest.matchers.maps.haveKey5import io.kotest.matchers.maps.haveSize6import io.kotest.matchers.maps.shouldContain7import io.kotest.matchers.should8import io.kotest.matchers.shouldBe9import io.kotest.matchers.string.shouldBeEmpty10import kotlin.test.Test11class ToParametersTest {12 @Test13 fun givenEmptyQuery_thenReturnEmptyMap() {14 "".asQuery().toParameters() should beEmpty()15 }16 @Test17 fun givenQueryWithoutVariableSeparator_thenReturnSingleElement() {18 "someVariable=someValue".asQuery().toParameters() should haveSize(1)19 }20 @Test21 fun givenQueryWithoutValueSeparator_thenReturnElementMappedToEmptyString() {22 val result = "someVariable&someOtherValue".asQuery().toParameters()23 assertSoftly {24 result should haveSize(2)25 result shouldContain ("someVariable" to "")26 result shouldContain ("someOtherValue" to "")27 }28 }...

Full Screen

Full Screen

MatcherTest.kt

Source:MatcherTest.kt Github

copy

Full Screen

...17 "hello".shouldBeLowerCase() // 소문자로 작성되었는지 체크 합니다.18 val list = emptyList<String>()19 val list2 = listOf("aaa", "bbb", "ccc")20 val map = mapOf<String, String>(Pair("aa", "11"))21 list should beEmpty() // 원소가 비었는지 체크 합니다.22 list2 shouldBe sorted<String>() // 해당 자료형이 정렬 되었는지 체크 합니다.23 map should contain("aa", "11") // 해당 원소가 포함되었는지 체크 합니다.24 map should haveKey("aa") // 해당 key가 포함되었는지 체크 합니다.25 map should haveValue("11") // 해당 value가 포함되었는지 체크 합니다.26 }27}...

Full Screen

Full Screen

OrtConfigPackageCurationProviderFunTest.kt

Source:OrtConfigPackageCurationProviderFunTest.kt Github

copy

Full Screen

...17 * License-Filename: LICENSE18 */19package org.ossreviewtoolkit.analyzer.curation20import io.kotest.core.spec.style.StringSpec21import io.kotest.matchers.collections.beEmpty22import io.kotest.matchers.maps.beEmpty as beEmptyMap23import io.kotest.matchers.maps.shouldContainKeys24import io.kotest.matchers.should25import io.kotest.matchers.shouldNot26import org.ossreviewtoolkit.model.Identifier27class OrtConfigPackageCurationProviderFunTest : StringSpec() {28 init {29 "provider can load curations from the ort-config repository" {30 val azureCore = Identifier("NuGet::Azure.Core:1.22.0")31 val azureCoreAmqp = Identifier("NuGet::Azure.Core.Amqp:1.2.0")32 val curations = OrtConfigPackageCurationProvider().getCurationsFor(listOf(azureCore, azureCoreAmqp))33 curations.shouldContainKeys(azureCore, azureCoreAmqp)34 curations.getValue(azureCore) shouldNot beEmpty()35 curations.getValue(azureCoreAmqp) shouldNot beEmpty()36 }37 "provider does not fail for packages which have no curations" {38 val id = Identifier("Some:Bogus:Package:Id")39 val curations = OrtConfigPackageCurationProvider().getCurationsFor(listOf(id))40 curations should beEmptyMap()41 }42 }43}...

Full Screen

Full Screen

beEmpty

Using AI Code Generation

copy

Full Screen

1 val emptyMap = mapOf<String, Int>()2 emptyMap should beEmpty()3 val emptyList = listOf<String>()4 emptyList should beEmpty()5 emptyString should beEmpty()6 val emptyIterable = Iterable { listOf<String>() }7 emptyIterable should beEmpty()8 val emptySequence = Sequence { listOf<String>() }9 emptySequence should beEmpty()10 val emptyArray = arrayOf<String>()11 emptyArray should beEmpty()12 val emptyCollection = Collection { listOf<String>() }13 emptyCollection should beEmpty()14 val emptySet = setOf<String>()15 emptySet should beEmpty()16 val emptyList = listOf<String>()17 emptyList should beEmpty()18 val emptyList = listOf<String>()19 emptyList should beEmpty()20 val emptyList = listOf<String>()21 emptyList should beEmpty()22 val emptyList = listOf<String>()23 emptyList should beEmpty()24 val emptyList = listOf<String>()25 emptyList should beEmpty()26 val emptyList = listOf<String>()27 emptyList should beEmpty()

Full Screen

Full Screen

beEmpty

Using AI Code Generation

copy

Full Screen

1import io.kotest.matchers.maps.beEmpty2val map = mapOf("key" to "value")3map should beEmpty()4import io.kotest.matchers.collections.beEmpty5val list = listOf("one", "two")6list should beEmpty()7import io.kotest.matchers.collections.beEmpty8val set = setOf("one", "two")9set should beEmpty()10import io.kotest.matchers.ints.beEmpty11val intArray = intArrayOf(1, 2, 3)12intArray should beEmpty()13import io.kotest.matchers.longs.beEmpty14val longArray = longArrayOf(1, 2, 3)15longArray should beEmpty()16import io.kotest.matchers.floats.beEmpty17val floatArray = floatArrayOf(1.0f, 2.0f, 3.0f)18floatArray should beEmpty()19import io.kotest.matchers.doubles.beEmpty20val doubleArray = doubleArrayOf(1.0, 2.0, 3.0)21doubleArray should beEmpty()22import io.kotest.matchers.bytes.beEmpty23val byteArray = byteArrayOf(1, 2, 3)24byteArray should beEmpty()25import io.kotest.matchers.shorts.beEmpty26val shortArray = shortArrayOf(1, 2, 3)27shortArray should beEmpty()28import io.kotest.matchers.chars.beEmpty29val charArray = charArrayOf('a', 'b', 'c')

Full Screen

Full Screen

beEmpty

Using AI Code Generation

copy

Full Screen

1val map = mapOf ( "one" to 1 , "two" to 2 )2 map . shouldNotBeEmpty ()3 map . shouldNotBeEmpty ( "map" )4val map = mapOf ( "one" to 1 , "two" to 2 )5 map . shouldNotBeEmpty ()6 map . shouldNotBeEmpty ( "map" )7val map = mapOf ( "one" to 1 , "two" to 2 )8 map . shouldContain ( "one" , 1 )9 map . shouldContain ( "one" , 1 , "map" )10 map . shouldContain ( "one" to 1 )11 map . shouldContain ( "one" to 1 , "map" )12val map = mapOf ( "one" to 1 , "two" to 2 )13 map . shouldContainAll ( "one" , 1 )14 map . shouldContainAll ( "one" , 1 , "map" )15 map . shouldContainAll ( "one" to 1 )16 map . shouldContainAll ( "one" to 1 , "map" )17val map = mapOf ( "one" to 1 , "two" to 2 )18 map . shouldContainAll ( "one" , 1 )19 map . shouldContainAll ( "one" , 1 , "map" )20 map . shouldContainAll ( "one" to 1 )21 map . shouldContainAll ( "one" to 1 , "map" )22val map = mapOf ( "one" to 1 , "two" to 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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful