How to use test method of io.kotest.matchers.collections.containAll class

Best Kotest code snippet using io.kotest.matchers.collections.containAll.test

AbstractDependencyNavigatorTest.kt

Source:AbstractDependencyNavigatorTest.kt Github

copy

Full Screen

...16 * SPDX-License-Identifier: Apache-2.017 * License-Filename: LICENSE18 */19package org.ossreviewtoolkit.model20import io.kotest.core.spec.style.WordSpec21import io.kotest.matchers.collections.beEmpty22import io.kotest.matchers.collections.contain23import io.kotest.matchers.collections.containAll24import io.kotest.matchers.collections.containExactly25import io.kotest.matchers.collections.containExactlyInAnyOrder26import io.kotest.matchers.collections.haveSize27import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder28import io.kotest.matchers.maps.containExactly as containExactlyEntries29import io.kotest.matchers.sequences.beEmpty as beEmptySequence30import io.kotest.matchers.sequences.containExactly as containSequenceExactly31import io.kotest.matchers.should32import io.kotest.matchers.shouldBe33import io.kotest.matchers.shouldNot34import io.kotest.matchers.shouldNotBe35import java.io.File36import java.time.Instant37import org.ossreviewtoolkit.utils.test.readOrtResult38import org.ossreviewtoolkit.utils.test.shouldNotBeNull39/**40 * A base class for tests of concrete [DependencyNavigator] implementations.41 *42 * The class is configured with an ORT result file that contains the expected results in a specific format. It then43 * runs tests on the [DependencyNavigator] of this result and checks whether it returns the correct dependency44 * information.45 */46abstract class AbstractDependencyNavigatorTest : WordSpec() {47 /** The name of the result file to be used by all test cases. */48 protected abstract val resultFileName: String49 /**50 * The name of the file with a result that contains issues. This is used by tests of the collectIssues() function.51 */52 protected abstract val resultWithIssuesFileName: String53 private val testResult by lazy { readOrtResult(resultFileName) }54 private val testProject by lazy { testResult.getProject(PROJECT_ID)!! }55 protected val navigator by lazy { testResult.dependencyNavigator }56 init {57 "scopeNames" should {58 "return the scope names of a project" {59 navigator.scopeNames(testProject) should containExactlyInAnyOrder("compile", "test")60 }61 }62 "directDependencies" should {63 "return the direct dependencies of a project" {64 navigator.directDependencies(testProject, "test").map { it.id } should containSequenceExactly(65 Identifier("Maven:org.scalacheck:scalacheck_2.12:1.13.5"),66 Identifier("Maven:org.scalatest:scalatest_2.12:3.0.4")67 )68 }69 "return an empty sequence for an unknown scope" {70 navigator.directDependencies(testProject, "unknownScope") should beEmptySequence()71 }72 }73 "scopeDependencies" should {74 "return a map with scopes and their dependencies for a project" {75 val scopeDependencies = navigator.scopeDependencies(testProject)76 scopeDependencies.keys should containExactlyInAnyOrder("compile", "test")77 scopeDependencies["compile"] shouldNotBeNull {78 this should haveSize(17)79 this should containAll(80 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),81 Identifier("Maven:org.scala-lang:scala-reflect:2.12.2"),82 Identifier("Maven:org.scala-lang:scala-library:2.12.3")83 )84 }85 scopeDependencies["test"] shouldNotBeNull {86 this should haveSize(6)87 this should containAll(88 Identifier("Maven:org.scalacheck:scalacheck_2.12:1.13.5"),89 Identifier("Maven:org.scalactic:scalactic_2.12:3.0.4")90 )91 }92 }93 "return a map with scopes and their direct dependencies by using maxDepth = 1" {94 val scopeDependencies = navigator.scopeDependencies(testProject, maxDepth = 1)95 scopeDependencies["compile"] shouldNotBeNull {96 this should haveSize(7)97 this shouldNot contain(Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"))98 }99 }100 "return a map with scopes and their dependencies up to a given maxDepth" {101 val scopeDependencies = navigator.scopeDependencies(testProject, maxDepth = 2)102 scopeDependencies["compile"] shouldNotBeNull {103 this should haveSize(14)104 this shouldNot contain(105 Identifier("Maven:org.scala-lang.modules:scala-java8-compat_2.12:0.8.0")106 )107 }108 }109 "return a map with scopes and their dependencies with filter criteria" {110 val matchedIds = mutableSetOf<Identifier>()111 val scopeDependencies = navigator.scopeDependencies(testProject) { node ->112 matchedIds += node.id113 node.id.namespace == "com.typesafe.akka"114 }115 scopeDependencies["compile"] shouldNotBeNull {116 this should containExactlyInAnyOrder(117 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),118 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")119 )120 }121 matchedIds should haveSize(23)122 }123 }124 "dependenciesForScope" should {125 "return an empty set for an unknown scope" {126 navigator.dependenciesForScope(testProject, "unknownScope") should beEmpty()127 }128 "return the dependencies of a specific scope" {129 val compileDependencies = navigator.dependenciesForScope(testProject, "compile")130 compileDependencies should haveSize(17)131 compileDependencies should containAll(132 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),133 Identifier("Maven:org.scala-lang:scala-reflect:2.12.2"),134 Identifier("Maven:org.scala-lang:scala-library:2.12.3")135 )136 }137 "return the dependencies of a specific scope up to a given maxDepth" {138 val compileDependencies = navigator.dependenciesForScope(testProject, "compile", maxDepth = 2)139 compileDependencies should haveSize(14)140 compileDependencies shouldNot contain(141 Identifier("Maven:org.scala-lang.modules:scala-java8-compat_2.12:0.8.0")142 )143 }144 "return the dependencies of a specific scope with filter criteria" {145 val akkaDependencies = navigator.dependenciesForScope(testProject, "compile") { node ->146 "akka" in node.id.namespace147 }148 akkaDependencies.shouldContainExactlyInAnyOrder(149 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),150 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")151 )152 }153 }154 "packageDependencies" should {155 "return the dependencies of an existing package in a project" {156 val pkgId = Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")157 val dependencies = navigator.packageDependencies(testProject, pkgId)158 dependencies should containExactlyInAnyOrder(159 Identifier("Maven:com.typesafe:ssl-config-core_2.12:0.2.2"),160 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),161 Identifier("Maven:org.scala-lang.modules:scala-java8-compat_2.12:0.8.0"),162 Identifier("Maven:org.reactivestreams:reactive-streams:1.0.1")163 )164 }165 "return an empty set for the dependencies of a non-existing package" {166 val pkgId = Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.7")167 val dependencies = navigator.packageDependencies(testProject, pkgId)168 dependencies should beEmpty()169 }170 "support a maxDepth filter" {171 val pkgId = Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")172 val dependencies = navigator.packageDependencies(testProject, pkgId, maxDepth = 1)173 dependencies should containExactlyInAnyOrder(174 Identifier("Maven:com.typesafe:ssl-config-core_2.12:0.2.2"),175 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6"),176 Identifier("Maven:org.reactivestreams:reactive-streams:1.0.1")177 )178 }179 "support a DependencyMatcher" {180 val pkgId = Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")181 val dependencies = navigator.packageDependencies(testProject, pkgId) { node ->182 node.id.namespace.startsWith("com.typesafe")183 }184 dependencies should containExactlyInAnyOrder(185 Identifier("Maven:com.typesafe:ssl-config-core_2.12:0.2.2"),186 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6")187 )188 }189 }190 "getShortestPaths" should {191 "return the shortest paths for a project" {192 val paths = navigator.getShortestPaths(testProject)193 paths.keys should haveSize(2)194 paths["compile"] shouldNotBeNull {195 this should containExactlyEntries(196 Identifier("Maven:ch.qos.logback:logback-classic:1.2.3") to emptyList(),197 Identifier("Maven:ch.qos.logback:logback-core:1.2.3") to listOf(198 Identifier("Maven:ch.qos.logback:logback-classic:1.2.3")199 ),200 Identifier("Maven:com.fasterxml.jackson.core:jackson-annotations:2.8.0") to listOf(201 Identifier("Maven:net.logstash.logback:logstash-logback-encoder:4.11"),202 Identifier("Maven:com.fasterxml.jackson.core:jackson-databind:2.8.9")203 ),204 Identifier("Maven:com.fasterxml.jackson.core:jackson-core:2.8.9") to listOf(205 Identifier("Maven:net.logstash.logback:logstash-logback-encoder:4.11"),206 Identifier("Maven:com.fasterxml.jackson.core:jackson-databind:2.8.9")207 ),208 Identifier("Maven:com.fasterxml.jackson.core:jackson-databind:2.8.9") to listOf(209 Identifier("Maven:net.logstash.logback:logstash-logback-encoder:4.11")210 ),211 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6") to listOf(212 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")213 ),214 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6") to emptyList(),215 Identifier("Maven:com.typesafe:config:1.3.1") to emptyList(),216 Identifier("Maven:com.typesafe.scala-logging:scala-logging_2.12:3.7.2") to emptyList(),217 Identifier("Maven:com.typesafe:ssl-config-core_2.12:0.2.2") to listOf(218 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")219 ),220 Identifier("Maven:net.logstash.logback:logstash-logback-encoder:4.11") to emptyList(),221 Identifier("Maven:org.scala-lang:scala-library:2.12.3") to emptyList(),222 Identifier("Maven:org.scala-lang:scala-reflect:2.12.2") to listOf(223 Identifier("Maven:com.typesafe.scala-logging:scala-logging_2.12:3.7.2")224 ),225 Identifier("Maven:org.scala-lang.modules:scala-java8-compat_2.12:0.8.0") to listOf(226 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6"),227 Identifier("Maven:com.typesafe.akka:akka-actor_2.12:2.5.6")228 ),229 Identifier("Maven:org.reactivestreams:reactive-streams:1.0.1") to listOf(230 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6")231 ),232 Identifier("Maven:org.slf4j:jcl-over-slf4j:1.7.25") to emptyList(),233 Identifier("Maven:org.slf4j:slf4j-api:1.7.25") to listOf(234 Identifier("Maven:ch.qos.logback:logback-classic:1.2.3")235 ),236 )237 }238 }239 }240 "projectDependencies" should {241 "return the dependencies of a project" {242 val scopeDependencies = navigator.scopeDependencies(testProject)243 val projectDependencies = navigator.projectDependencies(testProject)244 scopeDependencies.keys should containExactlyInAnyOrder("compile", "test")245 val expectedDependencies = scopeDependencies.getValue("compile") + scopeDependencies.getValue("test")246 projectDependencies should containExactlyInAnyOrder(expectedDependencies)247 }248 "support filtering the dependencies of a project" {249 val dependencies = navigator.projectDependencies(testProject, 1) {250 it.linkage != PackageLinkage.PROJECT_DYNAMIC251 }252 dependencies should containExactlyInAnyOrder(253 Identifier("Maven:ch.qos.logback:logback-classic:1.2.3"),254 Identifier("Maven:com.typesafe:config:1.3.1"),255 Identifier("Maven:com.typesafe.akka:akka-stream_2.12:2.5.6"),256 Identifier("Maven:com.typesafe.scala-logging:scala-logging_2.12:3.7.2"),257 Identifier("Maven:net.logstash.logback:logstash-logback-encoder:4.11"),258 Identifier("Maven:org.scala-lang:scala-library:2.12.3"),259 Identifier("Maven:org.slf4j:jcl-over-slf4j:1.7.25"),260 Identifier("Maven:org.scalacheck:scalacheck_2.12:1.13.5"),261 Identifier("Maven:org.scalatest:scalatest_2.12:3.0.4")262 )263 }264 "return no dependencies for a maxDepth of 0" {265 val dependencies = navigator.projectDependencies(testProject, 0)266 dependencies should beEmpty()267 }268 }269 "collectSubProjects" should {270 "find all the sub projects of a project" {271 val projectId = Identifier("SBT:com.pbassiner:multi1_2.12:0.1-SNAPSHOT")272 testResult.getProject(projectId) shouldNotBeNull {273 val subProjectIds = navigator.collectSubProjects(this)274 subProjectIds should containExactly(PROJECT_ID)275 }276 }277 }278 "dependencyTreeDepth" should {279 "calculate the dependency tree depth for a project" {280 navigator.dependencyTreeDepth(testProject, "compile") shouldBe 3281 navigator.dependencyTreeDepth(testProject, "test") shouldBe 2282 }283 "return 0 if the scope cannot be resolved" {284 navigator.dependencyTreeDepth(testProject, "unknownScope") shouldBe 0285 }286 }287 "projectIssues" should {288 "return the issues of a project" {289 val ortResultWithIssues = File(resultWithIssuesFileName).readValue<OrtResult>()290 val project = ortResultWithIssues.analyzer?.result?.projects.orEmpty().first()291 val navigator = ortResultWithIssues.dependencyNavigator292 val issues = navigator.projectIssues(project)293 issues should containExactlyEntries(294 Identifier("Maven:org.scala-lang.modules:scala-java8-compat_2.12:0.8.0") to setOf(295 OrtIssue(296 Instant.EPOCH,297 "Gradle",298 "Test issue 1"299 )300 ),301 Identifier("Maven:org.scalactic:scalactic_2.12:3.0.4") to setOf(302 OrtIssue(303 Instant.EPOCH,304 "Gradle",305 "Test issue 2"306 )307 )308 )309 }310 }311 "DependencyNode.equals" should {312 "be reflexive" {313 val node = navigator.directDependencies(testProject, "compile").iterator().next()314 node shouldBe node315 }316 "return false for a different node" {317 val iterator = navigator.directDependencies(testProject, "compile").iterator()318 val node1 = iterator.next().getStableReference()319 val node2 = iterator.next()320 node1 shouldNotBe node2321 }322 "return true the same node" {323 val node1 = navigator.directDependencies(testProject, "compile").iterator().next()324 .getStableReference()325 val node2 = navigator.directDependencies(testProject, "compile").iterator().next()326 .getStableReference()327 node1 shouldBe node2328 node1.hashCode() shouldBe node2.hashCode()329 }330 "return false for another object" {331 val node = navigator.directDependencies(testProject, "compile").iterator().next()332 node shouldNotBe this333 }334 }335 }336}337/** Identifier of the project used by the tests. */338private val PROJECT_ID = Identifier("SBT:com.pbassiner:common_2.12:0.1-SNAPSHOT")...

Full Screen

Full Screen

RunRobotConfigurationTest.kt

Source:RunRobotConfigurationTest.kt Github

copy

Full Screen

23import de.qualersoft.robotframework.gradleplugin.PLUGIN_ID4import de.qualersoft.robotframework.gradleplugin.extensions.RobotFrameworkExtension5import de.qualersoft.robotframework.gradleplugin.robotframework6import io.kotest.matchers.collections.beEmpty7import io.kotest.matchers.collections.contain8import io.kotest.matchers.collections.containAll9import io.kotest.matchers.collections.containsInOrder10import io.kotest.matchers.collections.haveSize11import io.kotest.matchers.should12import io.kotest.matchers.shouldNot13import org.gradle.api.Project14import org.gradle.testfixtures.ProjectBuilder15import org.junit.jupiter.api.Test16import org.junit.jupiter.api.assertAll17import java.io.File18import java.nio.file.Paths1920internal class RunRobotConfigurationTest : ConfigurationTestBase() {2122 private val project: Project = ProjectBuilder.builder().build().also {23 it.pluginManager.apply(PLUGIN_ID)24 }2526 private val rf: RobotFrameworkExtension = project.robotframework()2728 @Test29 fun settingTheSuiteStatLevelOfBotRobotConfiguration() {30 val result = applyConfig {31 it.suiteStatLevel.set(5)32 }.generateArguments().toList()3334 assertAll(35 { result should containsInOrder(listOf("--suitestatlevel", "5")) }36 )37 }3839 @Test40 fun `generate default run arguments`() {41 val result = applyConfig { }.generateArguments().toList()42 val expected = createDefaultsWithoutExtensionParam() + listOf("-F", "robot")43 assertAll(44 { result should haveSize(expected.size) },45 { result should containAll(expected) }46 )47 }4849 @Test50 fun `add an extension to default should override default entry`() {51 val result = applyConfig {52 it.extension.add("newRobot")53 }.generateArguments().toList()54 val expected = createDefaultsWithoutExtensionParam() + listOf("-F", "newRobot")55 assertAll(56 { result should haveSize(expected.size) },57 { result should containAll(expected) },58 { result shouldNot contain("robot") }59 )60 }6162 @Test63 fun `add two extensions should result in two entries`() {64 val result = applyConfig {65 it.extension.add("newRobot1")66 it.extension.add("newRobot2")67 }.generateArguments().toList()68 val expected = createDefaultsWithoutExtensionParam() + listOf("-F", "newRobot1", "-F", "newRobot2")69 assertAll(70 { result should haveSize(expected.size) },71 { result should containAll(expected) },72 { result shouldNot contain("robot") }73 )74 }7576 @Test77 fun `empty the extension should also remove default`() {78 val result = applyConfig {79 it.extension.empty()80 }.generateArguments().toList()81 val expected = createDefaultsWithoutExtensionParam()82 assertAll(83 { result should haveSize(expected.size) },84 { result should containAll(expected) },85 { result shouldNot contain("robot") }86 )87 }8889 @Test90 fun addSingleVariable() {91 val result = applyConfig {92 it.variables.put("MyVar", "42")93 }.generateArguments().toList()9495 assertAll(96 { result shouldNot beEmpty() },97 { result should containsInOrder(listOf("-v", "MyVar:42")) }98 )99 }100101 @Test102 fun addMultibleVariables() {103 val result = applyConfig {104 it.variables.putAll(mapOf("MyVar1" to "42", "MyVar2" to "0815"))105 }.generateArguments().toList()106107 assertAll(108 { result shouldNot beEmpty() },109 { result should containsInOrder(listOf("-v", "MyVar1:42")) },110 { result should containsInOrder(listOf("-v", "MyVar2:0815")) }111 )112 }113114 @Test115 fun addVariableFiles() {116 val result = applyConfig {117 it.variableFiles.add("./settings.property")118 }.generateArguments().toList()119 val expected = createDefaults() + listOf("-V", "./settings.property")120 assertAll(121 { result should haveSize(expected.size) },122 { result should containAll(expected) }123 )124 }125126 @Test127 fun addDebugFile() {128 val file = if (System.getProperty("os.name").contains("wind", true)) {129 File("C:\\temp")130 } else {131 File("/temp")132 }133134 val result = applyConfig {135 it.debugFile.fileValue(file)136 }.generateArguments().toList()137 val expected = createDefaults() + listOf("-b", file.absolutePath)138 assertAll(139 { result should haveSize(expected.size) },140 { result should containAll(expected) }141 )142 }143144 @Test145 fun `set maxerrorlines to negative will generate NONE entry`() {146 val result = applyConfig {147 it.maxErrorLines.set(-1)148 }.generateArguments().toList()149 val expected = listOf(150 "-d", Paths.get(project.buildDir.absolutePath, "reports", "robotframework").toFile().absolutePath,151 "-l", "log.html", "-r", "report.html", "-x", "robot-xunit-results.xml", "-F", "robot",152 "--randomize", "none", "--console", "verbose", "-W", "78", "-K", "auto", "--maxerrorlines", "none"153 )154 assertAll(155 { result should haveSize(expected.size) },156 { result should containAll(expected) },157 { result shouldNot contain("40") }158 )159 }160161 @Test162 fun addListener() {163 val result = applyConfig {164 it.listener.add("aListener")165 }.generateArguments().toList()166 val expected = createDefaults() + listOf("--listener", "aListener")167 assertAll(168 { result should haveSize(expected.size) },169 { result should containAll(expected) }170 )171 }172173 @Test174 fun enableDryrunMode() {175 val result = applyConfig {176 it.dryrun.set(true)177 }.generateArguments().toList()178 val expected = createDefaults() + listOf("--dryrun")179 assertAll(180 { result should haveSize(expected.size) },181 { result should containAll(expected) }182 )183 }184185 @Test186 fun enableExitOnFailureMode() {187 val result = applyConfig {188 it.exitOnFailure.set(true)189 }.generateArguments().toList()190 val expected = createDefaults() + listOf("-X")191 assertAll(192 { result should haveSize(expected.size) },193 { result should containAll(expected) }194 )195 }196197 @Test198 fun enableExitOnErrorMode() {199 val result = applyConfig {200 it.exitOnError.set(true)201 }.generateArguments().toList()202 val expected = createDefaults() + listOf("--exitonerror")203 assertAll(204 { result should haveSize(expected.size) },205 { result should containAll(expected) }206 )207 }208209 @Test210 fun enableSkipTearDownOnExitMode() {211 val result = applyConfig {212 it.skipTearDownOnExit.set(true)213 }.generateArguments().toList()214 val expected = createDefaults() + listOf("--skipteardownonexit")215 assertAll(216 { result should haveSize(expected.size) },217 { result should containAll(expected) }218 )219 }220221 @Test222 fun changeRandomizeMode() {223 val result = applyConfig {224 it.randomize.set("tests:1234")225 }.generateArguments().toList()226 val expected = listOf(227 "-d", Paths.get(project.buildDir.absolutePath, "reports", "robotframework").toFile().absolutePath,228 "-l", "log.html", "-r", "report.html", "-x", "robot-xunit-results.xml", "-F", "robot",229 "--randomize", "tests:1234", "--console", "verbose", "-W", "78", "-K", "auto", "--maxerrorlines", "40"230 )231 assertAll(232 { result should haveSize(expected.size) },233 { result should containAll(expected) },234 { result shouldNot contain("none") }235 )236 }237238 @Test239 fun addPreRunModifier() {240 val result = applyConfig {241 it.preRunModifier.add("preRun")242 }.generateArguments().toList()243 val expected = createDefaults() + listOf("--prerunmodifier", "preRun") ...

Full Screen

Full Screen

RtcpSrPacketTest.kt

Source:RtcpSrPacketTest.kt Github

copy

Full Screen

...13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package org.jitsi.rtp.rtcp17import io.kotest.assertions.throwables.shouldThrow18import io.kotest.core.spec.IsolationMode19import io.kotest.core.spec.style.ShouldSpec20import io.kotest.matchers.collections.shouldHaveSize21import io.kotest.matchers.shouldBe22import io.kotest.matchers.shouldNotBe23import org.jitsi.rtp.util.byteBufferOf24import java.lang.IllegalArgumentException25import java.nio.ByteBuffer26internal class RtcpSrPacketTest : ShouldSpec() {27 override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf28 private val expectedSenderInfo = SenderInfoBuilder(29 ntpTimestampMsw = 0x7FFFFFFF,30 ntpTimestampLsw = 0xFFFFFFFF,31 rtpTimestamp = 0xFFFFFFFF,32 sendersPacketCount = 0xFFFFFFFF,33 sendersOctetCount = 0xFFFFFFFF34 )35 private val reportBlock1 = RtcpReportBlock(36 ssrc = 12345,...

Full Screen

Full Screen

VcsInfoTest.kt

Source:VcsInfoTest.kt Github

copy

Full Screen

...18 */19package org.ossreviewtoolkit.model20import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException21import com.fasterxml.jackson.module.kotlin.readValue22import io.kotest.assertions.throwables.shouldThrow23import io.kotest.core.spec.style.WordSpec24import io.kotest.matchers.collections.containAll25import io.kotest.matchers.should26import io.kotest.matchers.shouldBe27class VcsInfoTest : WordSpec({28 "Deserializing VcsInfo" should {29 "work when all fields are given" {30 val yaml = """31 ---32 type: "type"33 url: "url"34 revision: "revision"35 path: "path"36 """.trimIndent()37 println(yaml)38 val vcsInfo = yamlMapper.readValue<VcsInfo>(yaml)39 with(vcsInfo) {40 type shouldBe VcsType("type")...

Full Screen

Full Screen

ScanOssResultParserTest.kt

Source:ScanOssResultParserTest.kt Github

copy

Full Screen

...16 * SPDX-License-Identifier: Apache-2.017 * License-Filename: LICENSE18 */19package org.ossreviewtoolkit.scanner.scanners.scanoss20import io.kotest.core.spec.style.WordSpec21import io.kotest.matchers.collections.containAll22import io.kotest.matchers.collections.containExactlyInAnyOrder23import io.kotest.matchers.collections.haveSize24import io.kotest.matchers.should25import java.io.File26import java.time.Instant27import kotlinx.serialization.json.decodeFromStream28import org.ossreviewtoolkit.clients.scanoss.FullScanResponse29import org.ossreviewtoolkit.clients.scanoss.ScanOssService30import org.ossreviewtoolkit.model.CopyrightFinding31import org.ossreviewtoolkit.model.LicenseFinding32import org.ossreviewtoolkit.model.TextLocation33import org.ossreviewtoolkit.utils.spdx.SpdxConstants34class ScanOssResultParserTest : WordSpec({35 "generateSummary()" should {36 "properly summarize JUnit 4.12 findings" {37 val result = File("src/test/assets/scanoss-junit-4.12.json").inputStream().use {38 ScanOssService.JSON.decodeFromStream<FullScanResponse>(it)39 }40 val time = Instant.now()41 val summary = generateSummary(time, time, SpdxConstants.NONE, result)42 summary.licenses.map { it.toString() } should containExactlyInAnyOrder(43 "Apache-2.0",44 "EPL-1.0",45 "MIT",46 "LicenseRef-scancode-free-unknown",47 "LicenseRef-scanoss-SSPL"48 )49 summary.licenseFindings should haveSize(201)50 summary.licenseFindings should containAll(51 LicenseFinding(...

Full Screen

Full Screen

containAll.kt

Source:containAll.kt Github

copy

Full Screen

1package io.kotest.matchers.collections2import io.kotest.matchers.Matcher3import io.kotest.matchers.MatcherResult4import io.kotest.matchers.should5import io.kotest.matchers.shouldNot6fun <T> Iterable<T>.shouldContainAll(vararg ts: T) = toList().shouldContainAll(ts)7fun <T> Array<T>.shouldContainAll(vararg ts: T) = asList().shouldContainAll(ts)8fun <T> Collection<T>.shouldContainAll(vararg ts: T) = this should containAll(*ts)9infix fun <T> Iterable<T>.shouldContainAll(ts: Collection<T>) = toList().shouldContainAll(ts)10infix fun <T> Array<T>.shouldContainAll(ts: Collection<T>) = asList().shouldContainAll(ts)11infix fun <T> Collection<T>.shouldContainAll(ts: Collection<T>) = this should containAll(ts)12fun <T> Iterable<T>.shouldNotContainAll(vararg ts: T) = toList().shouldNotContainAll(ts)13fun <T> Array<T>.shouldNotContainAll(vararg ts: T) = asList().shouldNotContainAll(ts)14fun <T> Collection<T>.shouldNotContainAll(vararg ts: T) = this shouldNot containAll(*ts)15infix fun <T> Iterable<T>.shouldNotContainAll(ts: Collection<T>) = toList().shouldNotContainAll(ts)16infix fun <T> Array<T>.shouldNotContainAll(ts: Collection<T>) = asList().shouldNotContainAll(ts)17infix fun <T> Collection<T>.shouldNotContainAll(ts: Collection<T>) = this shouldNot containAll(ts)18fun <T> containAll(vararg ts: T) = containAll(ts.asList())19fun <T> containAll(ts: Collection<T>): Matcher<Collection<T>> = object : Matcher<Collection<T>> {20 override fun test(value: Collection<T>): MatcherResult {21 val missing = ts.filterNot { value.contains(it) }22 val passed = missing.isEmpty()23 val failure =24 { "Collection should contain all of ${ts.printed().value} but was missing ${missing.printed().value}" }25 val negFailure = { "Collection should not contain all of ${ts.printed().value}" }26 return MatcherResult(passed, failure, negFailure)27 }28}...

Full Screen

Full Screen

ShouldContainAllTest.kt

Source:ShouldContainAllTest.kt Github

copy

Full Screen

1package com.sksamuel.kotest.matchers.collections2import io.kotest.assertions.throwables.shouldThrow3import io.kotest.core.spec.style.WordSpec4import io.kotest.matchers.collections.containAll5import io.kotest.matchers.collections.shouldContainAll6import io.kotest.matchers.collections.shouldNotContainAll7import io.kotest.matchers.should8import io.kotest.matchers.throwable.shouldHaveMessage9class ShouldContainAllTest : WordSpec() {10 init {11 "containsAll" should {12 "test that a collection contains all the elements but in any order" {13 val col = listOf(1, 2, 3, 4, 5)14 col should containAll(1, 2, 3)15 col should containAll(3, 2, 1)16 col should containAll(5, 1)17 col should containAll(1, 5)18 col should containAll(1)19 col should containAll(5)20 col.shouldContainAll(1, 2, 3)21 col.shouldContainAll(3, 1)22 col.shouldContainAll(3)23 col.shouldNotContainAll(6)24 col.shouldNotContainAll(1, 6)25 col.shouldNotContainAll(6, 1)26 shouldThrow<AssertionError> {...

Full Screen

Full Screen

UserRepositoryTests.kt

Source:UserRepositoryTests.kt Github

copy

Full Screen

1package dev.jmfayard2import io.kotest.matchers.collections.containAll3import io.kotest.matchers.should4import io.kotest.matchers.shouldBe5import kotlinx.coroutines.flow.toList6import kotlinx.coroutines.runBlocking7import org.junit.jupiter.api.AfterAll8import org.junit.jupiter.api.Assertions.assertEquals9import org.junit.jupiter.api.BeforeAll10import org.junit.jupiter.api.Test11import org.springframework.beans.factory.getBean12import org.springframework.context.ConfigurableApplicationContext13import org.springframework.fu.kofu.application14class UserRepositoryTests {15 private val dataApp = application {16 enable(dataConfig)17 }18 private lateinit var context: ConfigurableApplicationContext19 @BeforeAll20 fun beforeAll() {21 context = dataApp.run(profiles = "test")22 }23 @Test24 fun count() {25 val repository = context.getBean<UserRepository>()26 runBlocking {27 assertEquals(3, repository.count())28 }29 }30 @Test31 fun findAll() {32 val repository = context.getBean<UserRepository>()33 val expected = listOf(34 User("smaldini", "Stéphane", "Maldini"),35 User("sdeleuze", "Sébastien", "Deleuze"),...

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1import io.kotest.assertions.throwables.shouldThrow2import io.kotest.matchers.collections.containAll3import io.kotest.matchers.should4import io.kotest.matchers.shouldNot5import org.junit.Test6class ListTest{7fun `should throw an error when list does not contain all elements`(){8val list = listOf(1,2,3,4)9shouldThrow<AssertionError>{10list should containAll(1,2,3,4,5)11}12}13fun `should not throw an error when list contains all elements`(){14val list = listOf(1,2,3,4)15list should containAll(1,2,3,4)16}17}

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 fun `test containAll method`() {2 val list = listOf(1, 2, 3)3 list should containAll(1, 2, 3)4 }5 fun `test shouldContainAll method`() {6 val list = listOf(1, 2, 3)7 list shouldContainAll listOf(1, 2, 3)8 }9 fun `test shouldContainAllInOrder method`() {10 val list = listOf(1, 2, 3)11 list shouldContainAllInOrder listOf(1, 2, 3)12 }13 fun `test shouldContainAllInOrder method`() {14 val list = listOf(1, 2, 3)15 list shouldContainAllInOrder listOf(1, 2, 3)16 }17 fun `test shouldContainAllInOrder method`() {18 val list = listOf(1, 2, 3)19 list shouldContainAllInOrder listOf(1, 2, 3)20 }21 fun `test shouldContainAllInOrder method`() {22 val list = listOf(1, 2, 3)23 list shouldContainAllInOrder listOf(1, 2, 3)24 }25 fun `test shouldContainAllInOrder method`() {26 val list = listOf(1, 2, 3)27 list shouldContainAllInOrder listOf(1, 2, 3)28 }

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 val list = listOf(1, 2, 3)2 list should containAll(1, 2)3I have tried to use the following code to import the package but it doesn’t work4 import io.kotest.matchers.collections.containAll5I have also tried to use the following code to import the package but it doesn’t work6 import io.kotest.matchers.collections.*7I am using the following code to import the package but it doesn’t work8 import io.kotest.matchers.collections.containAll.*9I have also tried to use the following code to import the package but it doesn’t work10 import io.kotest.matchers.collections.containAll.containAll11I am using the following code to import the package but it doesn’t work12 import io.kotest.matchers.collections.containAll.containAll.*13I have also tried to use the following code to import the package but it doesn’t work14 import io.kotest.matchers.collections.containAll.containAll.containAll15I am using the following code to import the package but it doesn’t work16 import io.kotest.matchers.collections.containAll.containAll.containAll.*17I have also tried to use the following code to import the package but it doesn’t work18 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll19I am using the following code to import the package but it doesn’t work20 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.*21I have also tried to use the following code to import the package but it doesn’t work22 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll23I am using the following code to import the package but it doesn’t work24 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll.*25I have also tried to use the following code to import the package but it doesn’t work26 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll.containAll27I am using the following code to import the package but it doesn’t work28 import io.kotest.matchers.collections.cont29Expected: a map containing all of [a=1, b=2] but: was {a=1, b=2}

Full Screen

Full Screen

test

Using AI Code Generation

copy

Full Screen

1 val list = listOf(1, 2, 3)2 list should containAll(1, 2)3I have tried to use the following code to import the package but it doesn’t work4 import io.kotest.matchers.collections.containAll5I have also tried to use the following code to import the package but it doesn’t work6 import io.kotest.matchers.collections.*7I am using the following code to import the package but it doesn’t work8 import io.kotest.matchers.collections.containAll.*9I have also tried to use the following code to import the package but it doesn’t work10 import io.kotest.matchers.collections.containAll.containAll11I am using the following code to import the package but it doesn’t work12 import io.kotest.matchers.collections.containAll.containAll.*13I have also tried to use the following code to import the package but it doesn’t work14 import io.kotest.matchers.collections.containAll.containAll.containAll15I am using the following code to import the package but it doesn’t work16 import io.kotest.matchers.collections.containAll.containAll.containAll.*17I have also tried to use the following code to import the package but it doesn’t work18 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll19I am using the following code to import the package but it doesn’t work20 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.*21I have also tried to use the following code to import the package but it doesn’t work22 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll23I am using the following code to import the package but it doesn’t work24 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll.*25I have also tried to use the following code to import the package but it doesn’t work26 import io.kotest.matchers.collections.containAll.containAll.containAll.containAll.containAll.containAll27I am using the following code to import the package but it doesn’t work28 import io.kotest.matchers.collections.cont

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Kotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful