diff --git a/README.md b/README.md index 3020fd88e..f042b1945 100644 --- a/README.md +++ b/README.md @@ -100,14 +100,17 @@ See [Plugin Signing](https://plugins.jetbrains.com/docs/intellij/plugin-signing. ```bash $ gradlew test # Run tests (and collect coverage) $ gradlew test --tests X # Run tests in class X (package name optional) -$ gradlew test -Pkotest.tags="X" # Run tests with `NamedTag` X (also supports not (!), and (&), or (|)) +$ gradlew test -Pkotest.tags="X" # Run tests matching tag(s) X (also supports not (!), and (&), or (|)) $ gradlew koverHtmlReport # Create HTML coverage report for previous test run $ gradlew check # Run tests and static analysis $ gradlew runPluginVerifier # Check for compatibility issues ``` -#### 🏷️ Filtering tests +#### 🏷️ Tagging and filtering tests [Kotest tests can be tagged](https://kotest.io/docs/framework/tags.html) to allow selectively running tests. +The tags for Randomness are statically defined in +[`Tags`](https://github.com/FWDekker/intellij-randomness/blob/main/src/test/kotlin/com/fwdekker/randomness/testhelpers/Tags.kt). + Tag an entire test class by adding `tags(...)` to the class definition, or tag an individual test `context` by writing `context("foo").config(tags = setOf(...)) {`. It is not possible to tag an individual `test` due to limitations in Kotest. diff --git a/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt b/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt index d73b3fe97..bbdef7743 100644 --- a/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt +++ b/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt @@ -128,8 +128,14 @@ fun Cell>.withSimpleRenderer(toString: (E) -> String = { it.toSt * A predicate that always returns [output]. */ class LiteralPredicate(private val output: Boolean) : ComponentPredicate() { + /** + * Does nothing, because there's no need to respond to any events to determine the output of [invoke]. + */ override fun addListener(listener: (Boolean) -> Unit) = Unit + /** + * Returns [output]. + */ override fun invoke() = output } diff --git a/src/test/kotlin/com/fwdekker/randomness/CapitalizationModeTest.kt b/src/test/kotlin/com/fwdekker/randomness/CapitalizationModeTest.kt index d3a31dc73..e283318e7 100644 --- a/src/test/kotlin/com/fwdekker/randomness/CapitalizationModeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/CapitalizationModeTest.kt @@ -1,7 +1,9 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.matchBundle import io.kotest.assertions.retry import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.should import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe import io.kotest.matchers.string.shouldBeEqualIgnoringCase @@ -72,7 +74,7 @@ object CapitalizationModeTest : FunSpec({ context("toLocalizedString") { test("returns the associated localized string") { - CapitalizationMode.FIRST_LETTER.toLocalizedString() shouldBe Bundle("shared.capitalization.first_letter") + CapitalizationMode.FIRST_LETTER.toLocalizedString() should matchBundle("shared.capitalization.first_letter") } } }) diff --git a/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt b/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt index 515d625a7..2c1709846 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt @@ -1,10 +1,10 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain @@ -14,7 +14,7 @@ import io.kotest.matchers.string.shouldNotContain * Unit tests for [ErrorReporter]. */ object ErrorReporterTest : FunSpec({ - tags(NamedTag("IdeaFixture")) + tags(Tags.IDEA_FIXTURE) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt b/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt index efd1fa4b0..2d1e4cca2 100644 --- a/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt @@ -1,9 +1,9 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.beEmpty import io.kotest.matchers.collections.shouldContainExactly @@ -65,7 +65,7 @@ object TypeIconTest : FunSpec({ context("paintIcon") { - tags(NamedTag("Swing")) + tags(Tags.SWING) lateinit var image: BufferedImage @@ -105,7 +105,7 @@ object TypeIconTest : FunSpec({ */ object OverlayIconTest : FunSpec({ context("paintIcon") { - tags(NamedTag("Swing")) + tags(Tags.SWING) lateinit var image: BufferedImage @@ -207,7 +207,7 @@ object OverlayedIconTest : FunSpec({ context("paintIcon") { - tags(NamedTag("Swing")) + tags(Tags.SWING) lateinit var image: BufferedImage diff --git a/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt index 2d24c3413..019e839ad 100644 --- a/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt @@ -4,6 +4,7 @@ import com.fwdekker.randomness.testhelpers.DummyDecoratorScheme import com.fwdekker.randomness.testhelpers.DummyDecoratorSchemeEditor import com.fwdekker.randomness.testhelpers.DummyScheme import com.fwdekker.randomness.testhelpers.DummySchemeEditor +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -13,7 +14,6 @@ import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.dsl.builder.bindText import com.intellij.ui.dsl.builder.panel -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldContainExactly import io.kotest.matchers.ints.shouldBeGreaterThanOrEqual @@ -33,7 +33,7 @@ import javax.swing.JCheckBox * Unit tests for [SchemeEditor]. */ object SchemeEditorTest : FunSpec({ - tags(NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt index fb3770986..7f51b0422 100644 --- a/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt @@ -2,8 +2,8 @@ package com.fwdekker.randomness import com.fwdekker.randomness.testhelpers.DummyDecoratorScheme import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.beEmpty import io.kotest.matchers.collections.shouldContainExactly @@ -18,10 +18,10 @@ import java.awt.Color * Unit tests for [Scheme]. */ object SchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) - context("icon") { + context("f:icon") { test("returns null if the type icon is null") { val scheme = DummyScheme() @@ -146,6 +146,9 @@ object SchemeTest : FunSpec({ * Unit tests for [DecoratorScheme]. */ object DecoratorSchemeTest : FunSpec({ + tags(Tags.SCHEME) + + context("generateStrings") { test("throws an exception if the decorator is invalid") { val decorator = DummyDecoratorScheme(enabled = true, valid = false) diff --git a/src/test/kotlin/com/fwdekker/randomness/StateTest.kt b/src/test/kotlin/com/fwdekker/randomness/StateTest.kt index 05febaf9a..10cc4eb36 100644 --- a/src/test/kotlin/com/fwdekker/randomness/StateTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/StateTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness import com.fwdekker.randomness.testhelpers.DummyState -import io.kotest.core.NamedTag +import com.fwdekker.randomness.testhelpers.Tags import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldHaveSize import io.kotest.matchers.shouldBe @@ -13,7 +13,7 @@ import io.kotest.matchers.types.shouldBeSameInstanceAs * Unit tests for [State]. */ object StateTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("uuid") { diff --git a/src/test/kotlin/com/fwdekker/randomness/TimelyTest.kt b/src/test/kotlin/com/fwdekker/randomness/TimelyTest.kt index 74f02d868..a71214a3f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/TimelyTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/TimelyTest.kt @@ -2,8 +2,10 @@ package com.fwdekker.randomness import com.fwdekker.randomness.Timely.GENERATOR_TIMEOUT import com.fwdekker.randomness.Timely.generateTimely +import com.fwdekker.randomness.testhelpers.matchBundle import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.should import io.kotest.matchers.shouldBe @@ -17,7 +19,7 @@ object TimelyTest : FunSpec({ test("throws an exception if the generator does not finish within time") { shouldThrow { generateTimely { Thread.sleep(GENERATOR_TIMEOUT + 1000L) } } - .message shouldBe Bundle("helpers.error.timed_out") + .message should matchBundle("helpers.error.timed_out") } test("throws an exception if the generator throws an exception") { diff --git a/src/test/kotlin/com/fwdekker/randomness/XmlHelpersTest.kt b/src/test/kotlin/com/fwdekker/randomness/XmlHelpersTest.kt index f1039503a..102531e75 100644 --- a/src/test/kotlin/com/fwdekker/randomness/XmlHelpersTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/XmlHelpersTest.kt @@ -3,6 +3,8 @@ package com.fwdekker.randomness import com.intellij.openapi.util.JDOMUtil import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldContainExactly +import io.kotest.matchers.nulls.beNull +import io.kotest.matchers.should import io.kotest.matchers.shouldBe @@ -55,7 +57,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getContentByName("needle")?.name shouldBe null + element.getContentByName("needle")?.name should beNull() } test("returns `null` if multiple children have the given name") { @@ -70,7 +72,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getContentByName("needle")?.name shouldBe null + element.getContentByName("needle")?.name should beNull() } } @@ -100,7 +102,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getAttributeValueByName("needle") shouldBe null + element.getAttributeValueByName("needle") should beNull() } test("returns `null` if multiple children have the given name") { @@ -115,7 +117,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getAttributeValueByName("needle") shouldBe null + element.getAttributeValueByName("needle") should beNull() } test("returns `null` if the child does not have a value attribute") { @@ -129,7 +131,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getAttributeValueByName("needle") shouldBe null + element.getAttributeValueByName("needle") should beNull() } } @@ -161,7 +163,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getAttributeValueByName("needle") shouldBe null + element.getAttributeValueByName("needle") should beNull() element.setAttributeValueByName("needle", "new-value") @@ -214,7 +216,7 @@ object XmlHelpersTest : FunSpec({ test("returns `null` if there are no children") { val element = JDOMUtil.load("") - element.getSingleContent() shouldBe null + element.getSingleContent() should beNull() } test("returns `null` if there are multiple children") { @@ -227,7 +229,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getSingleContent() shouldBe null + element.getSingleContent() should beNull() } } @@ -291,7 +293,7 @@ object XmlHelpersTest : FunSpec({ """.trimIndent() ) - element.getContentByPath("wrong", null, "prong", null)?.name shouldBe null + element.getContentByPath("wrong", null, "prong", null)?.name should beNull() } } }) diff --git a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt index 2a9d7ba5f..6e96cc9e1 100644 --- a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.affix import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -13,7 +14,6 @@ import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.layout.selected import io.kotest.assertions.throwables.shouldNotThrowAny -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -29,7 +29,7 @@ import javax.swing.JCheckBox * Unit tests for [AffixDecoratorEditor]. */ object AffixDecoratorEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt index 17e356732..74db1629f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt @@ -1,8 +1,8 @@ package com.fwdekker.randomness.affix import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -13,7 +13,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [AffixDecorator]. */ object AffixDecoratorTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt index 986e0bf36..4d571bc79 100644 --- a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.array import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -14,7 +15,6 @@ import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.TitledSeparator -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.matchers.collections.beEmpty @@ -29,7 +29,7 @@ import javax.swing.JCheckBox * Unit tests for [ArrayDecoratorEditor]. */ object ArrayDecoratorEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt index 61f05437a..018e45bdb 100644 --- a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt @@ -2,8 +2,8 @@ package com.fwdekker.randomness.array import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -15,7 +15,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [ArrayDecorator]. */ object ArrayDecoratorTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt index d2ee06e8c..fa459d173 100644 --- a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.datetime import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.dateTimeProp @@ -12,7 +13,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.matchers.shouldBe @@ -25,7 +25,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [DateTimeSchemeEditor]. */ object DateTimeSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt index f867f1189..0a338a9e5 100644 --- a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt @@ -2,9 +2,9 @@ package com.fwdekker.randomness.datetime import com.fwdekker.randomness.integer.IntegerScheme import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.withClue -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -16,7 +16,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [DateTimeScheme]. */ object DateTimeSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt index 0078f9b89..171c90ec9 100644 --- a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.decimal import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -12,7 +13,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import org.assertj.swing.edt.FailOnThreadViolationRepaintManager @@ -24,7 +24,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [DecimalSchemeEditor]. */ object DecimalSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt index 12afab892..b2d677b22 100644 --- a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt @@ -3,8 +3,8 @@ package com.fwdekker.randomness.decimal import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -15,7 +15,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [DecimalScheme]. */ object DecimalSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt index f87112129..72ed6c6b1 100644 --- a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.fixedlength import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -12,7 +13,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import org.assertj.swing.edt.FailOnThreadViolationRepaintManager @@ -24,7 +24,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [FixedLengthDecoratorEditor]. */ object FixedLengthDecoratorEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt index 4e56ed05f..c57663a5a 100644 --- a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt @@ -1,8 +1,8 @@ package com.fwdekker.randomness.fixedlength import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -13,7 +13,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [FixedLengthDecorator]. */ object FixedLengthDecoratorTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt index 898eec6a2..315cd9862 100644 --- a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.integer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -13,7 +14,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -26,7 +26,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [IntegerSchemeEditor]. */ object IntegerSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt index 76010bc31..80cc15c26 100644 --- a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt @@ -4,9 +4,9 @@ import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.fixedlength.FixedLengthDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.withClue -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -18,7 +18,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [IntegerScheme]. */ object IntegerSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt index 5ca3b21e0..3348c5daf 100644 --- a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt @@ -3,6 +3,7 @@ package com.fwdekker.randomness.string import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -13,7 +14,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import org.assertj.swing.edt.FailOnThreadViolationRepaintManager @@ -25,7 +25,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [StringSchemeEditor]. */ object StringSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt index 60f4d46e9..d37b21d0f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt @@ -3,8 +3,8 @@ package com.fwdekker.randomness.string import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -15,7 +15,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [StringScheme]. */ object StringSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("isSimple") { diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt index 7c2aab2bf..e385c9072 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt @@ -1,11 +1,11 @@ package com.fwdekker.randomness.template +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.intellij.openapi.actionSystem.ActionManager import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.beEmpty import io.kotest.matchers.collections.shouldHaveAtLeastSize @@ -18,7 +18,7 @@ import io.kotest.matchers.shouldNot * Unit tests for [TemplateActionLoader]. */ object TemplateActionLoaderTest : FunSpec({ - tags(NamedTag("IdeaFixture")) + tags(Tags.IDEA_FIXTURE) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt index 6126f49ba..2ccc69014 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt @@ -1,16 +1,16 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.Bundle import com.fwdekker.randomness.Icons import com.fwdekker.randomness.OverlayIcon import com.fwdekker.randomness.OverlayedIcon import com.fwdekker.randomness.TypeIcon import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.matchBundle import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -27,7 +27,7 @@ import java.awt.Color * Unit tests for [TemplateGroupAction]. */ object TemplateGroupActionTest : FunSpec({ - tags(NamedTag("IdeaFixture")) + tags(Tags.IDEA_FIXTURE) lateinit var ideaFixture: IdeaTestFixture @@ -132,7 +132,7 @@ object TemplateInsertActionTest : FunSpec({ * Unit tests for [TemplateSettingsAction]. */ object TemplateSettingsActionTest : FunSpec({ - tags(NamedTag("IdeaFixture")) + tags(Tags.IDEA_FIXTURE) lateinit var ideaFixture: IdeaTestFixture @@ -153,7 +153,7 @@ object TemplateSettingsActionTest : FunSpec({ test("uses a default text if the template is null") { val action = TemplateSettingsAction(template = null) - action.templatePresentation.text shouldBe Bundle("template.name.settings") + action.templatePresentation.text should matchBundle("template.name.settings") } test("uses the template's name if the template is not null") { diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt index c123d6f9a..68dcf63ab 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt @@ -1,12 +1,12 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet import com.fwdekker.randomness.testhelpers.prop import com.fwdekker.randomness.testhelpers.textProp -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.matchers.shouldBe @@ -19,7 +19,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [TemplateEditor]. */ object TemplateEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var frame: FrameFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt index 83555329b..c27917291 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt @@ -4,6 +4,7 @@ import com.fwdekker.randomness.Scheme import com.fwdekker.randomness.Settings import com.fwdekker.randomness.setAll import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.getActionButton @@ -15,7 +16,6 @@ import com.intellij.openapi.actionSystem.ActionToolbar import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.Row3 import io.kotest.data.row @@ -39,7 +39,7 @@ import org.assertj.swing.fixture.FrameFixture */ @Suppress("detekt:LargeClass") // Would be weird to split up given that CUT is not split up either object TemplateJTreeTest : FunSpec({ - tags(NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListConfigurableTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListConfigurableTest.kt index 85baf0fba..9fd30591c 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListConfigurableTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListConfigurableTest.kt @@ -1,6 +1,7 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.Settings +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -11,7 +12,6 @@ import com.intellij.openapi.options.ConfigurationException import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.should import io.kotest.matchers.shouldBe @@ -25,7 +25,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [TemplateListConfigurable]. */ class TemplateListConfigurableTest : FunSpec({ - tags(NamedTag("IdeaFixture")) + tags(Tags.IDEA_FIXTURE) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt index 95079a658..34c0b9c41 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt @@ -8,6 +8,7 @@ import com.fwdekker.randomness.integer.IntegerScheme import com.fwdekker.randomness.setAll import com.fwdekker.randomness.string.StringScheme import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -20,7 +21,6 @@ import com.intellij.openapi.util.Disposer import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.Row2 import io.kotest.data.row @@ -40,7 +40,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [TemplateListEditor]. */ object TemplateListEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt index 7f9c32471..61804d774 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt @@ -4,6 +4,7 @@ import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.Settings import com.fwdekker.randomness.editorFieldsTestFactory import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -14,10 +15,11 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.matchers.collections.shouldNotContain +import io.kotest.matchers.nulls.beNull +import io.kotest.matchers.should import io.kotest.matchers.shouldBe import org.assertj.swing.edt.FailOnThreadViolationRepaintManager import org.assertj.swing.fixture.Containers @@ -28,7 +30,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [TemplateReferenceEditor]. */ object TemplateReferenceEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture @@ -76,7 +78,7 @@ object TemplateReferenceEditorTest : FunSpec({ reference.template = null guiRun { editor.reset() } - guiGet { frame.comboBox("template").itemProp().get() } shouldBe null + guiGet { frame.comboBox("template").itemProp().get() } should beNull() } test("does not load the reference's parent as a selectable option") { diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt index fcffceb65..8cf084344 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt @@ -1,16 +1,16 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.Bundle import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.OverlayIcon import com.fwdekker.randomness.Settings import com.fwdekker.randomness.setAll import com.fwdekker.randomness.stateDeepCopyTestFactory import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.matchBundle import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -25,7 +25,7 @@ import io.kotest.matchers.shouldNot * Unit tests for [TemplateReference]. */ object TemplateReferenceTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) lateinit var list: TemplateList @@ -48,7 +48,7 @@ object TemplateReferenceTest : FunSpec({ test("returns an alternative name if no template is set") { reference.template = null - reference.name shouldBe Bundle("reference.title") + reference.name should matchBundle("reference.title") } test("returns the referenced template's name with brackets") { diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt index acd6b2cfd..ffebfb1d6 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt @@ -8,10 +8,10 @@ import com.fwdekker.randomness.integer.IntegerScheme import com.fwdekker.randomness.stateDeepCopyTestFactory import com.fwdekker.randomness.string.StringScheme import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import com.fwdekker.randomness.word.WordScheme import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -26,7 +26,7 @@ import kotlin.random.Random * Unit tests for [Template]. */ object TemplateTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("typeIcon") { diff --git a/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt index 49f40c95f..0e3a62711 100644 --- a/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt @@ -9,6 +9,9 @@ import io.kotest.matchers.shouldNotBe * Non-comprehensive tests and sanity checks for [DummyScheme]. */ object DummySchemeTest : FunSpec({ + tags(Tags.SCHEME) + + test("does not equal another fresh instance") { DummyScheme() shouldNotBe DummyScheme() } diff --git a/src/test/kotlin/com/fwdekker/randomness/testhelpers/Tags.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/Tags.kt new file mode 100644 index 000000000..7362b8721 --- /dev/null +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/Tags.kt @@ -0,0 +1,31 @@ +package com.fwdekker.randomness.testhelpers + +import io.kotest.core.NamedTag + + +/** + * Tags for Kotest-based tags for filtering tests. + * + * See the project's README for more information. + */ +object Tags { + /** + * Tests for [com.fwdekker.randomness.SchemeEditor]s. + */ + val EDITOR = NamedTag("Editor") + + /** + * Tests that rely on setting up an IDE fixture. + */ + val IDEA_FIXTURE = NamedTag("IdeaFixture") + + /** + * Tests for [com.fwdekker.randomness.Scheme]s. + */ + val SCHEME = NamedTag("Scheme") + + /** + * Tests that rely on accessing Swing components. + */ + val SWING = NamedTag("Swing") +} diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt index 8abab2a22..cbc3d6e1a 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt @@ -1,13 +1,14 @@ package com.fwdekker.randomness.ui -import com.fwdekker.randomness.Bundle +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.matchBundle import com.github.sisyphsu.dateparser.DateParserUtils import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec +import io.kotest.matchers.should import io.kotest.matchers.shouldBe import org.assertj.swing.edt.FailOnThreadViolationRepaintManager import java.text.ParseException @@ -19,7 +20,7 @@ import java.time.Month * Unit tests for [JDateTimeField]. */ object JDateTimeFieldTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) lateinit var field: JDateTimeField @@ -47,7 +48,7 @@ object JDateTimeFieldTest : FunSpec({ context("set") { test("throws an error if a non-date-time is set") { shouldThrow { guiRun { field.setValue("invalid") } } - .message shouldBe Bundle("datetime_field.error.invalid_type") + .message should matchBundle("datetime_field.error.invalid_type") } } @@ -98,7 +99,7 @@ object JDateTimeFieldTest : FunSpec({ shouldThrow { field.text = null field.commitEdit() - }.message shouldBe Bundle("datetime_field.error.empty_string") + }.message should matchBundle("datetime_field.error.empty_string") } } @@ -107,7 +108,7 @@ object JDateTimeFieldTest : FunSpec({ shouldThrow { field.text = "" field.commitEdit() - }.message shouldBe Bundle("datetime_field.error.empty_string") + }.message should matchBundle("datetime_field.error.empty_string") } } diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt index da6bae9e2..5c555ef35 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt @@ -1,9 +1,9 @@ package com.fwdekker.randomness.ui +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.guiGet import com.fwdekker.randomness.testhelpers.guiRun import io.kotest.assertions.throwables.shouldThrow -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.nulls.beNull import io.kotest.matchers.should @@ -16,7 +16,7 @@ import javax.swing.JSpinner * Unit tests for [JNumberSpinner]. */ object JNumberSpinnerTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) beforeContainer { @@ -59,7 +59,7 @@ object JNumberSpinnerTest : FunSpec({ * Unit tests for [bindSpinners]. */ object BindSpinnersTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) beforeContainer { @@ -104,7 +104,7 @@ object BindSpinnersTest : FunSpec({ * Unit tests for [JDoubleSpinner]. */ object JDoubleSpinnerTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) beforeContainer { @@ -157,7 +157,7 @@ object JDoubleSpinnerTest : FunSpec({ * Unit tests for [JLongSpinner]. */ object JLongSpinnerTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) beforeContainer { @@ -210,7 +210,7 @@ object JLongSpinnerTest : FunSpec({ * Unit tests for [JIntSpinner]. */ object JIntSpinnerTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) beforeContainer { diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt index 6373043a8..aa85f8824 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt @@ -1,12 +1,12 @@ package com.fwdekker.randomness.ui import com.fwdekker.randomness.testhelpers.DummySchemeEditor +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet import com.fwdekker.randomness.testhelpers.guiRun import com.intellij.openapi.ui.ComboBox import com.intellij.ui.dsl.builder.panel -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.Row2 import io.kotest.data.row @@ -27,10 +27,10 @@ import javax.swing.tree.MutableTreeNode /** - * Unit tests for extension functions in [ListenerHelpersKt]. + * Unit tests for extension functions in `ListenerHelpersKt`. */ object ListenerHelpersTest : FunSpec({ - tags(NamedTag("Swing")) + tags(Tags.SWING) var listenerInvoked = false diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt index 37e36d6b4..4c27ba0bb 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.ui import com.fwdekker.randomness.Bundle import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.find @@ -12,7 +13,6 @@ import com.intellij.openapi.util.Disposer import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.InplaceButton -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe @@ -25,7 +25,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [PreviewPanel]. */ object PreviewPanelTest : FunSpec({ - tags(NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt index 7c6326c24..489102971 100644 --- a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt @@ -2,6 +2,7 @@ package com.fwdekker.randomness.uuid import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.guiGet @@ -12,7 +13,6 @@ import com.fwdekker.randomness.testhelpers.textProp import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import org.assertj.swing.edt.FailOnThreadViolationRepaintManager @@ -24,7 +24,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [UuidSchemeEditor]. */ object UuidSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt index e5935fb43..11a0dfa66 100644 --- a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt @@ -3,8 +3,8 @@ package com.fwdekker.randomness.uuid import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -22,7 +22,7 @@ import io.kotest.matchers.string.shouldNotContain * Unit tests for [UuidScheme]. */ object UuidSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") { diff --git a/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt index e70c1fca7..305894f10 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt @@ -1,14 +1,13 @@ package com.fwdekker.randomness.word -import com.fwdekker.randomness.Bundle import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.matchBundle import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.beEmpty import io.kotest.matchers.collections.shouldContainExactly import io.kotest.matchers.longs.shouldBeLessThan import io.kotest.matchers.should -import io.kotest.matchers.shouldBe import java.io.IOException import kotlin.system.measureNanoTime @@ -26,7 +25,7 @@ object DefaultWordListTest : FunSpec({ test("throws an exception if the file does not exist") { val list = DefaultWordList("name", "word-lists/does-not-exist.txt") - shouldThrow { list.words }.message shouldBe Bundle("word_list.error.file_not_found") + shouldThrow { list.words }.message should matchBundle("word_list.error.file_not_found") } test("returns an empty list of words if the file is empty") { @@ -52,7 +51,7 @@ object DefaultWordListTest : FunSpec({ val list = DefaultWordList("name", "word-lists/does-not-exist.txt") shouldThrow { list.words } - shouldThrow { list.words }.message shouldBe Bundle("word_list.error.file_not_found") + .message should matchBundle("word_list.error.file_not_found") } test("returns words quicker if read again from the same instance") { diff --git a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt index 72e5ef568..c9298adbb 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt @@ -3,6 +3,7 @@ package com.fwdekker.randomness.word import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.afterNonContainer import com.fwdekker.randomness.testhelpers.beforeNonContainer import com.fwdekker.randomness.testhelpers.find @@ -18,7 +19,6 @@ import com.intellij.openapi.editor.impl.EditorComponentImpl import com.intellij.openapi.util.Disposer import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.matchers.collections.shouldContainExactly @@ -32,7 +32,7 @@ import org.assertj.swing.fixture.FrameFixture * Unit tests for [WordSchemeEditor]. */ object WordSchemeEditorTest : FunSpec({ - tags(NamedTag("Editor"), NamedTag("IdeaFixture"), NamedTag("Swing")) + tags(Tags.EDITOR, Tags.IDEA_FIXTURE, Tags.SWING) lateinit var ideaFixture: IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt index 9664530fa..74fe3d23e 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt @@ -4,8 +4,8 @@ import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.Tags import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle -import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData @@ -16,7 +16,7 @@ import io.kotest.matchers.shouldBe * Unit tests for [WordScheme]. */ object WordSchemeTest : FunSpec({ - tags(NamedTag("Scheme")) + tags(Tags.SCHEME) context("generateStrings") {