From f144fcedca83916080bb2cfa33351010adbb96d2 Mon Sep 17 00:00:00 2001 From: "Florine W. Dekker" Date: Sat, 16 Sep 2023 16:43:02 +0200 Subject: [PATCH] Reorganise test helpers --- .config/detekt/.detekt.yml | 2 +- .../{ListHelper.kt => ListHelpers.kt} | 0 ...erHelper.kt => InterfaceBuilderHelpers.kt} | 0 .../{ListenerHelper.kt => ListenerHelpers.kt} | 2 + .../com/fwdekker/randomness/AssertJHelper.kt | 143 ------------------ .../fwdekker/randomness/EditorTestFactory.kt | 1 + .../fwdekker/randomness/ErrorReporterTest.kt | 2 + .../com/fwdekker/randomness/IconsTest.kt | 2 + .../fwdekker/randomness/InsertActionTest.kt | 1 + .../fwdekker/randomness/SchemeEditorTest.kt | 8 + .../com/fwdekker/randomness/SchemeTest.kt | 2 + .../com/fwdekker/randomness/SettingsTest.kt | 2 + .../com/fwdekker/randomness/StateTest.kt | 1 + .../fwdekker/randomness/StateTestFactory.kt | 1 + .../affix/AffixDecoratorEditorTest.kt | 16 +- .../randomness/affix/AffixDecoratorTest.kt | 2 +- .../array/ArrayDecoratorEditorTest.kt | 18 +-- .../randomness/array/ArrayDecoratorTest.kt | 2 +- .../datetime/DateTimeSchemeEditorTest.kt | 16 +- .../randomness/datetime/DateTimeSchemeTest.kt | 2 +- .../decimal/DecimalSchemeEditorTest.kt | 16 +- .../randomness/decimal/DecimalSchemeTest.kt | 2 +- .../FixedLengthDecoratorEditorTest.kt | 16 +- .../fixedlength/FixedLengthDecoratorTest.kt | 2 +- .../integer/IntegerSchemeEditorTest.kt | 18 +-- .../randomness/integer/IntegerSchemeTest.kt | 2 +- .../string/StringSchemeEditorTest.kt | 16 +- .../randomness/string/StringSchemeTest.kt | 2 +- .../template/TemplateActionLoaderTest.kt | 4 +- .../template/TemplateActionTests.kt | 6 +- .../randomness/template/TemplateEditorTest.kt | 10 +- .../template/TemplateJTreeModelTest.kt | 10 +- .../randomness/template/TemplateJTreeTest.kt | 14 +- .../template/TemplateListEditorTest.kt | 14 +- .../randomness/template/TemplateListTest.kt | 4 +- .../template/TemplateReferenceEditorTest.kt | 18 +-- .../template/TemplateReferenceTest.kt | 6 +- .../randomness/template/TemplateTest.kt | 4 +- .../testhelpers/AssertJSwingHelpers.kt | 71 +++++++++ .../testhelpers/AssertJSwingProperties.kt | 70 +++++++++ .../randomness/{ => testhelpers}/Dummies.kt | 11 +- .../{ => testhelpers}/DummySchemeTest.kt | 2 +- .../randomness/testhelpers/KotestHelpers.kt | 48 ++++++ .../KotestMatchers.kt} | 7 +- ...Test.kt => InterfaceBuilderHelpersTest.kt} | 4 +- .../randomness/ui/JDateTimeFieldTest.kt | 6 +- .../randomness/ui/JNumberSpinnerTest.kt | 4 +- .../ui/LengthDocumentFiltersTest.kt | 2 +- ...erHelperTest.kt => ListenerHelpersTest.kt} | 12 +- .../randomness/ui/PreviewPanelTest.kt | 14 +- .../randomness/uuid/UuidSchemeEditorTest.kt | 14 +- .../randomness/uuid/UuidSchemeTest.kt | 2 +- .../randomness/word/DefaultWordListTest.kt | 2 +- .../randomness/word/WordSchemeEditorTest.kt | 20 +-- .../randomness/word/WordSchemeTest.kt | 2 +- 55 files changed, 377 insertions(+), 301 deletions(-) rename src/main/kotlin/com/fwdekker/randomness/{ListHelper.kt => ListHelpers.kt} (100%) rename src/main/kotlin/com/fwdekker/randomness/ui/{InterfaceBuilderHelper.kt => InterfaceBuilderHelpers.kt} (100%) rename src/main/kotlin/com/fwdekker/randomness/ui/{ListenerHelper.kt => ListenerHelpers.kt} (99%) delete mode 100644 src/test/kotlin/com/fwdekker/randomness/AssertJHelper.kt create mode 100644 src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingHelpers.kt create mode 100644 src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingProperties.kt rename src/test/kotlin/com/fwdekker/randomness/{ => testhelpers}/Dummies.kt (91%) rename src/test/kotlin/com/fwdekker/randomness/{ => testhelpers}/DummySchemeTest.kt (93%) create mode 100644 src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestHelpers.kt rename src/test/kotlin/com/fwdekker/randomness/{Matchers.kt => testhelpers/KotestMatchers.kt} (92%) rename src/test/kotlin/com/fwdekker/randomness/ui/{InterfaceBuilderHelperTest.kt => InterfaceBuilderHelpersTest.kt} (77%) rename src/test/kotlin/com/fwdekker/randomness/ui/{ListenerHelperTest.kt => ListenerHelpersTest.kt} (94%) diff --git a/.config/detekt/.detekt.yml b/.config/detekt/.detekt.yml index ed3f4c87c..4a0ea58c2 100644 --- a/.config/detekt/.detekt.yml +++ b/.config/detekt/.detekt.yml @@ -18,7 +18,7 @@ complexity: active: false # [Exception] Acceptable for helper files. TooManyFunctions: - excludes: '**/*Helper.kt' + excludes: '**/*Helpers.kt' formatting: # [Disagree] Acceptable for many short arguments. diff --git a/src/main/kotlin/com/fwdekker/randomness/ListHelper.kt b/src/main/kotlin/com/fwdekker/randomness/ListHelpers.kt similarity index 100% rename from src/main/kotlin/com/fwdekker/randomness/ListHelper.kt rename to src/main/kotlin/com/fwdekker/randomness/ListHelpers.kt diff --git a/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelper.kt b/src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt similarity index 100% rename from src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelper.kt rename to src/main/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpers.kt diff --git a/src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelper.kt b/src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelpers.kt similarity index 99% rename from src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelper.kt rename to src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelpers.kt index 189217405..e64bd24c7 100644 --- a/src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelper.kt +++ b/src/main/kotlin/com/fwdekker/randomness/ui/ListenerHelpers.kt @@ -33,12 +33,14 @@ fun addChangeListenerTo(vararg components: Any, listener: () -> Unit) { component.addActionListener { listener() } addChangeListenerTo(component.editor.editorComponent, listener = listener) } + is JSpinner -> component.addChangeListener { listener() } is JTextComponent -> addChangeListenerTo(component.document, listener = listener) is JTree -> { component.model.addTreeModelListener(SimpleTreeModelListener { listener() }) component.addTreeSelectionListener { listener() } } + is SchemeEditor<*> -> component.addChangeListener(listener) else -> Unit } diff --git a/src/test/kotlin/com/fwdekker/randomness/AssertJHelper.kt b/src/test/kotlin/com/fwdekker/randomness/AssertJHelper.kt deleted file mode 100644 index f4f186b7a..000000000 --- a/src/test/kotlin/com/fwdekker/randomness/AssertJHelper.kt +++ /dev/null @@ -1,143 +0,0 @@ -package com.fwdekker.randomness - -import com.fwdekker.randomness.ui.JDateTimeField -import com.intellij.openapi.actionSystem.impl.ActionButton -import com.intellij.ui.dsl.builder.MutableProperty -import io.kotest.core.TestConfiguration -import io.kotest.core.spec.AfterAny -import io.kotest.core.spec.BeforeAny -import io.kotest.core.spec.style.scopes.ContainerScope -import io.kotest.core.test.TestType -import org.assertj.swing.core.GenericTypeMatcher -import org.assertj.swing.driver.ComponentDriver -import org.assertj.swing.edt.GuiActionRunner -import org.assertj.swing.fixture.AbstractComponentFixture -import org.assertj.swing.fixture.AbstractTwoStateButtonFixture -import org.assertj.swing.fixture.FrameFixture -import org.assertj.swing.fixture.JComboBoxFixture -import org.assertj.swing.fixture.JSpinnerFixture -import org.assertj.swing.fixture.JTextComponentFixture -import java.awt.Component -import javax.swing.AbstractButton -import kotlin.reflect.KMutableProperty0 - - -/** - * Runs [lambda] in the GUI thread. - * - * @param lambda the function to run in the GUI thread - */ -fun guiRun(lambda: () -> Unit) = GuiActionRunner.execute(lambda) - -/** - * Runs [lambda] in the GUI thread and returns the result. - * - * @param T the type of value to return - * @param lambda the function to run in the GUI thread - * @return the output of [lambda] - */ -fun guiGet(lambda: () -> T): T = GuiActionRunner.execute(lambda) - - -/** - * Creates a [GenericTypeMatcher] with a lambda. - * - * @param T the type of matcher to return - * @param klass the class to be matched - * @param requireValid `true` if and only if only valid components should be matched - * @param matcher the matcher that returns `true` if the desired component is found - * @return a [GenericTypeMatcher] with a lambda. - */ -fun matcher(klass: Class, requireValid: Boolean = true, matcher: (T) -> Boolean = { true }) = - object : GenericTypeMatcher(klass) { - override fun isMatching(component: T) = (!requireValid || component.isValid) && matcher(component) - } - -/** - * Finds a component that matches [matcher], or throws an exception if no matches exist. - * - * @param T the type of component to find - * @param matcher the matcher to compare components against - * @return the component that matches [matcher], if any - * @throws org.assertj.swing.exception.ComponentLookupException if no components match [matcher] - */ -fun FrameFixture.find(matcher: GenericTypeMatcher): T = - robot().finder().find(matcher) - -/** - * Returns the [ActionButton] that has [accessibleName]. - * - * @param accessibleName the name of the button to return - * @return the [ActionButton] that has [accessibleName] - * @throws org.assertj.swing.exception.ComponentLookupException if no [ActionButton] has [accessibleName] - */ -fun FrameFixture.getActionButton(accessibleName: String): ActionButton = - find(matcher(ActionButton::class.java) { it.accessibleContext.accessibleName == accessibleName }) - - -fun AbstractComponentFixture.requireEnabledIs(enabled: Boolean) = - if (enabled) this.requireEnabled() - else this.requireDisabled() - - -// TODO: Document these functions! -@Suppress("UNCHECKED_CAST") -fun KMutableProperty0.prop(): MutableProperty = MutableProperty({ get() }, { set(it as T) }) - -@Suppress("UNCHECKED_CAST") -fun SELF.prop(get: (SELF) -> (() -> FIELD), set: (SELF) -> ((FIELD) -> Unit)): MutableProperty = - MutableProperty(get(this)) { set(this)(it as FIELD) } - -fun AbstractTwoStateButtonFixture.isSelectedProp() = - this.prop({ this.target()::isSelected }, { this.target()::setSelected }) - -fun JComboBoxFixture.itemProp() = this.prop({ this.target()::getSelectedItem }, { this.target()::setSelectedItem }) - -fun JComboBoxFixture.textProp() = this.prop({ this.target().editor::getItem }, { this.target().editor::setItem }) - -fun JSpinnerFixture.valueProp() = this.prop({ this.target()::getValue }, { this.target()::setValue }) - -fun JTextComponentFixture.dateTimeProp() = (this.target() as JDateTimeField)::longValue.prop() - -fun JTextComponentFixture.textProp() = this.prop({ this.target()::getText }, { this.target()::setText }) - - -/** - * Runs [before] before every test, but, unlike, [TestConfiguration.beforeAny], does not run before other scopes. - */ -fun TestConfiguration.beforeNonContainer(before: BeforeAny) { - this.beforeAny { - if (it.type != TestType.Container) - before(it) - } -} - -/** - * Runs [before] before every test, but, unlike, [ContainerScope.beforeAny], does not run before other scopes. - */ -fun ContainerScope.beforeNonContainer(before: BeforeAny) { - this.beforeAny { - if (it.type != TestType.Container) - before(it) - } -} - -/** - * Runs [after] after every test, but, unlike, [TestConfiguration.afterAny], does not run after other scopes. - */ -fun TestConfiguration.afterNonContainer(after: AfterAny) { - this.afterAny { - if (it.a.type != TestType.Container) - after(it) - } -} - -/** - * Runs [after] after every test, but, unlike, [ContainerScope.afterAny], does not run after other scopes. - */ -fun ContainerScope.afterNonContainer(after: AfterAny) { - this.afterAny { - if (it.a.type != TestType.Container) - after(it) - } -} diff --git a/src/test/kotlin/com/fwdekker/randomness/EditorTestFactory.kt b/src/test/kotlin/com/fwdekker/randomness/EditorTestFactory.kt index be07670c3..d8b45bfb4 100644 --- a/src/test/kotlin/com/fwdekker/randomness/EditorTestFactory.kt +++ b/src/test/kotlin/com/fwdekker/randomness/EditorTestFactory.kt @@ -1,5 +1,6 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.guiRun import com.intellij.ui.dsl.builder.MutableProperty import io.kotest.assertions.withClue import io.kotest.core.factory.TestFactory diff --git a/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt b/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt index 13fdae702..515d625a7 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ErrorReporterTest.kt @@ -1,5 +1,7 @@ package com.fwdekker.randomness +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt b/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt index 2ab420f6a..e8b8e0ad5 100644 --- a/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/IconsTest.kt @@ -1,5 +1,7 @@ package com.fwdekker.randomness +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/InsertActionTest.kt b/src/test/kotlin/com/fwdekker/randomness/InsertActionTest.kt index 730ffdfff..e31b050a2 100644 --- a/src/test/kotlin/com/fwdekker/randomness/InsertActionTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/InsertActionTest.kt @@ -1,5 +1,6 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.DummyInsertAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.actionSystem.Presentation diff --git a/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt index c9ad23535..2d24c3413 100644 --- a/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/SchemeEditorTest.kt @@ -1,5 +1,13 @@ package com.fwdekker.randomness +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.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun import com.fwdekker.randomness.ui.withName import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory diff --git a/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt index 05d294201..fb3770986 100644 --- a/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/SchemeTest.kt @@ -1,5 +1,7 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.DummyDecoratorScheme +import com.fwdekker.randomness.testhelpers.DummyScheme import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/SettingsTest.kt b/src/test/kotlin/com/fwdekker/randomness/SettingsTest.kt index ae3c688be..1af6b1c93 100644 --- a/src/test/kotlin/com/fwdekker/randomness/SettingsTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/SettingsTest.kt @@ -2,6 +2,8 @@ package com.fwdekker.randomness import com.fwdekker.randomness.template.Template import com.fwdekker.randomness.template.TemplateList +import com.fwdekker.randomness.testhelpers.DummyState +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/StateTest.kt b/src/test/kotlin/com/fwdekker/randomness/StateTest.kt index d0a7cb0c5..9cfb60936 100644 --- a/src/test/kotlin/com/fwdekker/randomness/StateTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/StateTest.kt @@ -1,5 +1,6 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.DummyState import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.shouldContainExactly diff --git a/src/test/kotlin/com/fwdekker/randomness/StateTestFactory.kt b/src/test/kotlin/com/fwdekker/randomness/StateTestFactory.kt index ac752c884..1c0579a4e 100644 --- a/src/test/kotlin/com/fwdekker/randomness/StateTestFactory.kt +++ b/src/test/kotlin/com/fwdekker/randomness/StateTestFactory.kt @@ -1,5 +1,6 @@ package com.fwdekker.randomness +import com.fwdekker.randomness.testhelpers.beforeNonContainer import io.kotest.core.spec.style.funSpec import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe diff --git a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt index cbbff9012..44897222b 100644 --- a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorEditorTest.kt @@ -1,14 +1,14 @@ package com.fwdekker.randomness.affix -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.requireEnabledIs -import com.fwdekker.randomness.textProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.prop +import com.fwdekker.randomness.testhelpers.requireEnabledIs +import com.fwdekker.randomness.testhelpers.textProp import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.layout.selected @@ -113,7 +113,7 @@ object AffixDecoratorEditorTest : FunSpec({ row(true, true, true, true), ) ) { (predicateState, checkboxState, expectedCheckboxEnabled, expectedDescriptorEnabled) -> - val predicate = if (predicateState == null) null else toggle.selected + val predicate = predicateState?.let { toggle.selected } frame.cleanUp() editor = guiGet { AffixDecoratorEditor(scheme, presets = listOf("."), enabledIf = predicate) } diff --git a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt index fcf28757a..17e356732 100644 --- a/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/affix/AffixDecoratorTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness.affix -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt index 5bcaece39..7aaff0b72 100644 --- a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorEditorTest.kt @@ -1,16 +1,16 @@ package com.fwdekker.randomness.array -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.matcher -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.matcher +import com.fwdekker.randomness.testhelpers.prop +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 com.intellij.ui.TitledSeparator diff --git a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt index ed1ea0f24..61f05437a 100644 --- a/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/array/ArrayDecoratorTest.kt @@ -1,8 +1,8 @@ package com.fwdekker.randomness.array import com.fwdekker.randomness.affix.AffixDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt index af1bc2100..44ace8e81 100644 --- a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeEditorTest.kt @@ -1,15 +1,15 @@ package com.fwdekker.randomness.datetime -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.dateTimeProp import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.dateTimeProp +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.prop +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt index ab501a881..f867f1189 100644 --- a/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/datetime/DateTimeSchemeTest.kt @@ -1,8 +1,8 @@ package com.fwdekker.randomness.datetime import com.fwdekker.randomness.integer.IntegerScheme -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.withClue import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt index e01ba3317..d1bb4011a 100644 --- a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeEditorTest.kt @@ -1,15 +1,15 @@ package com.fwdekker.randomness.decimal -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.prop +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt index 77fbf012f..12afab892 100644 --- a/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/decimal/DecimalSchemeTest.kt @@ -2,8 +2,8 @@ package com.fwdekker.randomness.decimal import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt index b6d9397d9..34837c203 100644 --- a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorEditorTest.kt @@ -1,15 +1,15 @@ package com.fwdekker.randomness.fixedlength -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.prop +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt index d7eaf2562..4e56ed05f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/fixedlength/FixedLengthDecoratorTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness.fixedlength -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt index a4a94d265..9d761c851 100644 --- a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeEditorTest.kt @@ -1,16 +1,16 @@ package com.fwdekker.randomness.integer -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.requireEnabledIs -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.prop +import com.fwdekker.randomness.testhelpers.requireEnabledIs +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt index c21f0057d..add3ecf90 100644 --- a/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/integer/IntegerSchemeTest.kt @@ -3,8 +3,8 @@ package com.fwdekker.randomness.integer import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.fixedlength.FixedLengthDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.withClue import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt index f55dcd4d2..9aaa428e3 100644 --- a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeEditorTest.kt @@ -1,16 +1,16 @@ package com.fwdekker.randomness.string import com.fwdekker.randomness.CapitalizationMode -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.itemProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.itemProp +import com.fwdekker.randomness.testhelpers.prop +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt index c8098f0af..60f4d46e9 100644 --- a/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/string/StringSchemeTest.kt @@ -2,8 +2,8 @@ package com.fwdekker.randomness.string import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.array.ArrayDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt index cf8d06534..7c2aab2bf 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionLoaderTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt index 6d70fde10..98421a21e 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateActionTests.kt @@ -1,13 +1,13 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.Bundle -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Icons import com.fwdekker.randomness.OverlayIcon import com.fwdekker.randomness.OverlayedIcon import com.fwdekker.randomness.TypeIcon -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer +import com.fwdekker.randomness.testhelpers.DummyScheme +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt index f5aaeea4f..35d3c88b8 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateEditorTest.kt @@ -1,11 +1,11 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeModelTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeModelTest.kt index 7dbc494fd..200517e85 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeModelTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeModelTest.kt @@ -1,12 +1,12 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Scheme import com.fwdekker.randomness.State -import com.fwdekker.randomness.beEmptyIntArray -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.matchBundle -import com.fwdekker.randomness.shouldContainExactly +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.beEmptyIntArray +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.matchBundle +import com.fwdekker.randomness.testhelpers.shouldContainExactly import com.fwdekker.randomness.ui.SimpleTreeModelListener import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt index db5c759ce..45e5f4b1f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateJTreeTest.kt @@ -1,15 +1,15 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Scheme import com.fwdekker.randomness.Settings -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.getActionButton -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.matchBundle import com.fwdekker.randomness.setAll +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.getActionButton +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.matchBundle import com.intellij.openapi.actionSystem.ActionToolbar import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt index c4586d879..62b8d7060 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListEditorTest.kt @@ -1,18 +1,18 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Scheme import com.fwdekker.randomness.Settings -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.datetime.DateTimeScheme import com.fwdekker.randomness.decimal.DecimalScheme -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun import com.fwdekker.randomness.integer.IntegerScheme import com.fwdekker.randomness.setAll -import com.fwdekker.randomness.shouldContainExactly import com.fwdekker.randomness.string.StringScheme +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.shouldContainExactly import com.fwdekker.randomness.uuid.UuidScheme import com.fwdekker.randomness.word.WordScheme import com.intellij.testFramework.fixtures.IdeaTestFixture @@ -160,7 +160,7 @@ object TemplateListEditorTest : FunSpec({ editor.reset() frame.tree().target().setSelectionRow(1) } - }.message shouldBe "Unknown scheme type 'com.fwdekker.randomness.DummyScheme'." + }.message shouldBe "Unknown scheme type 'com.fwdekker.randomness.testhelpers.DummyScheme'." } } }) diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListTest.kt index 44da7bae8..b89d93e30 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateListTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateListTest.kt @@ -1,9 +1,9 @@ package com.fwdekker.randomness.template -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Settings -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.spec.style.FunSpec import io.kotest.data.row import io.kotest.datatest.withData diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt index e4b170542..d5935c747 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceEditorTest.kt @@ -1,17 +1,17 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.CapitalizationMode -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Settings -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.itemProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.itemProp +import com.fwdekker.randomness.testhelpers.prop +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt index 402e05ac5..e98c90723 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateReferenceTest.kt @@ -2,13 +2,13 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.Bundle import com.fwdekker.randomness.CapitalizationMode -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.OverlayIcon import com.fwdekker.randomness.Settings -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.setAll -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt index f6b645e3a..f3b7861a4 100644 --- a/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/template/TemplateTest.kt @@ -1,12 +1,12 @@ package com.fwdekker.randomness.template import com.fwdekker.randomness.DataGenerationException -import com.fwdekker.randomness.DummyScheme import com.fwdekker.randomness.Settings import com.fwdekker.randomness.array.ArrayDecorator import com.fwdekker.randomness.integer.IntegerScheme -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec diff --git a/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingHelpers.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingHelpers.kt new file mode 100644 index 000000000..ab28fc860 --- /dev/null +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingHelpers.kt @@ -0,0 +1,71 @@ +package com.fwdekker.randomness.testhelpers + +import com.intellij.openapi.actionSystem.impl.ActionButton +import org.assertj.swing.core.GenericTypeMatcher +import org.assertj.swing.driver.ComponentDriver +import org.assertj.swing.edt.GuiActionRunner +import org.assertj.swing.fixture.AbstractComponentFixture +import org.assertj.swing.fixture.FrameFixture +import java.awt.Component + + +/** + * Runs [lambda] in the GUI thread. + * + * @param lambda the function to run in the GUI thread + */ +fun guiRun(lambda: () -> Unit) = GuiActionRunner.execute(lambda) + +/** + * Runs [lambda] in the GUI thread and returns the result. + * + * @param T the type of value to return + * @param lambda the function to run in the GUI thread + * @return the output of [lambda] + */ +fun guiGet(lambda: () -> T): T = GuiActionRunner.execute(lambda) + + +/** + * Creates a [GenericTypeMatcher] with a lambda. + * + * @param T the type of matcher to return + * @param klass the class to be matched + * @param requireValid `true` if and only if only valid components should be matched + * @param matcher the matcher that returns `true` if the desired component is found + * @return a [GenericTypeMatcher] with a lambda. + */ +fun matcher(klass: Class, requireValid: Boolean = true, matcher: (T) -> Boolean = { true }) = + object : GenericTypeMatcher(klass) { + override fun isMatching(component: T) = (!requireValid || component.isValid) && matcher(component) + } + +/** + * Finds a component that matches [matcher], or throws an exception if no matches exist. + * + * @param T the type of component to find + * @param matcher the matcher to compare components against + * @return the component that matches [matcher], if any + * @throws org.assertj.swing.exception.ComponentLookupException if no components match [matcher] + */ +fun FrameFixture.find(matcher: GenericTypeMatcher): T = + robot().finder().find(matcher) + +/** + * Returns the [ActionButton] that has [accessibleName]. + * + * @param accessibleName the name of the button to return + * @return the [ActionButton] that has [accessibleName] + * @throws org.assertj.swing.exception.ComponentLookupException if no [ActionButton] has [accessibleName] + */ +fun FrameFixture.getActionButton(accessibleName: String): ActionButton = + find(matcher(ActionButton::class.java) { it.accessibleContext.accessibleName == accessibleName }) + + +/** + * Invokes [AbstractComponentFixture.requireEnabled] if [enabled] is `true`, and invokes + * [AbstractComponentFixture.requireDisabled] otherwise. + */ +fun AbstractComponentFixture.requireEnabledIs(enabled: Boolean): S = + if (enabled) this.requireEnabled() + else this.requireDisabled() diff --git a/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingProperties.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingProperties.kt new file mode 100644 index 000000000..a840bb119 --- /dev/null +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/AssertJSwingProperties.kt @@ -0,0 +1,70 @@ +package com.fwdekker.randomness.testhelpers + +import com.fwdekker.randomness.ui.JDateTimeField +import com.intellij.ui.dsl.builder.MutableProperty +import org.assertj.swing.fixture.AbstractTwoStateButtonFixture +import org.assertj.swing.fixture.JComboBoxFixture +import org.assertj.swing.fixture.JSpinnerFixture +import org.assertj.swing.fixture.JTextComponentFixture +import javax.swing.AbstractButton +import kotlin.reflect.KMutableProperty0 + + +/** + * Converts a [KMutableProperty0] of type [T] into a [MutableProperty] of type `Any?`. + */ +@Suppress("UNCHECKED_CAST") +fun KMutableProperty0.prop(): MutableProperty = MutableProperty({ get() }, { set(it as T) }) + +/** + * Creates a [MutableProperty] of type `Any?` from the given [get] and [set] functions. + */ +@Suppress("UNCHECKED_CAST") +fun SELF.prop(get: (SELF) -> (() -> FIELD), set: (SELF) -> ((FIELD) -> Unit)): MutableProperty = + MutableProperty(get(this)) { set(this)(it as FIELD) } + + +/** + * Creates a [MutableProperty] for the [AbstractButton.isSelected] field. + * + * Required until issue KT-8575 is solved. + */ +fun AbstractTwoStateButtonFixture.isSelectedProp() = + this.prop({ this.target()::isSelected }, { this.target()::setSelected }) + +/** + * Creates a [MutableProperty] for the [javax.swing.JComboBox.getSelectedItem] field. + * + * Required until issue KT-8575 is solved. + */ +fun JComboBoxFixture.itemProp() = + this.prop({ this.target()::getSelectedItem }, { this.target()::setSelectedItem }) + +/** + * Creates a [MutableProperty] for the [javax.swing.ComboBoxEditor.getItem] field. + * + * Required until issue KT-8575 is solved. + */ +fun JComboBoxFixture.textProp() = this.prop({ this.target().editor::getItem }, { this.target().editor::setItem }) + +/** + * Creates a [MutableProperty] for the [javax.swing.JSpinner.getValue] field. + * + * Required until issue KT-8575 is solved. + */ +fun JSpinnerFixture.valueProp() = this.prop({ this.target()::getValue }, { this.target()::setValue }) + +/** + * Creates a [MutableProperty] for the [JDateTimeField.longValue] field. + * + * Required until issue KT-8575 is solved. + */ +fun JTextComponentFixture.dateTimeProp() = (this.target() as JDateTimeField)::longValue.prop() + +/** + * Creates a [MutableProperty] for the [javax.swing.text.JTextComponent.getText] field. + * + * Required until issue KT-8575 is solved. + */ +fun JTextComponentFixture.textProp() = this.prop({ this.target()::getText }, { this.target()::setText }) + diff --git a/src/test/kotlin/com/fwdekker/randomness/Dummies.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/Dummies.kt similarity index 91% rename from src/test/kotlin/com/fwdekker/randomness/Dummies.kt rename to src/test/kotlin/com/fwdekker/randomness/testhelpers/Dummies.kt index 5c77606ba..efc2ca8ae 100644 --- a/src/test/kotlin/com/fwdekker/randomness/Dummies.kt +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/Dummies.kt @@ -1,5 +1,12 @@ -package com.fwdekker.randomness - +package com.fwdekker.randomness.testhelpers + +import com.fwdekker.randomness.DecoratorScheme +import com.fwdekker.randomness.Icons +import com.fwdekker.randomness.InsertAction +import com.fwdekker.randomness.Scheme +import com.fwdekker.randomness.SchemeEditor +import com.fwdekker.randomness.State +import com.fwdekker.randomness.TypeIcon import com.fwdekker.randomness.ui.withName import com.intellij.openapi.ui.DialogPanel import com.intellij.ui.dsl.builder.bindText diff --git a/src/test/kotlin/com/fwdekker/randomness/DummySchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt similarity index 93% rename from src/test/kotlin/com/fwdekker/randomness/DummySchemeTest.kt rename to src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt index f978c29d2..49f40c95f 100644 --- a/src/test/kotlin/com/fwdekker/randomness/DummySchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/DummySchemeTest.kt @@ -1,4 +1,4 @@ -package com.fwdekker.randomness +package com.fwdekker.randomness.testhelpers import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.shouldBe diff --git a/src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestHelpers.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestHelpers.kt new file mode 100644 index 000000000..d84c5f0b2 --- /dev/null +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestHelpers.kt @@ -0,0 +1,48 @@ +package com.fwdekker.randomness.testhelpers + +import io.kotest.core.TestConfiguration +import io.kotest.core.spec.AfterAny +import io.kotest.core.spec.BeforeAny +import io.kotest.core.spec.style.scopes.ContainerScope +import io.kotest.core.test.TestType + + +/** + * Runs [before] before every test, but, unlike, [TestConfiguration.beforeAny], does not run before other scopes. + */ +fun TestConfiguration.beforeNonContainer(before: BeforeAny) { + this.beforeAny { + if (it.type != TestType.Container) + before(it) + } +} + +/** + * Runs [before] before every test, but, unlike, [ContainerScope.beforeAny], does not run before other scopes. + */ +fun ContainerScope.beforeNonContainer(before: BeforeAny) { + this.beforeAny { + if (it.type != TestType.Container) + before(it) + } +} + +/** + * Runs [after] after every test, but, unlike, [TestConfiguration.afterAny], does not run after other scopes. + */ +fun TestConfiguration.afterNonContainer(after: AfterAny) { + this.afterAny { + if (it.a.type != TestType.Container) + after(it) + } +} + +/** + * Runs [after] after every test, but, unlike, [ContainerScope.afterAny], does not run after other scopes. + */ +fun ContainerScope.afterNonContainer(after: AfterAny) { + this.afterAny { + if (it.a.type != TestType.Container) + after(it) + } +} diff --git a/src/test/kotlin/com/fwdekker/randomness/Matchers.kt b/src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestMatchers.kt similarity index 92% rename from src/test/kotlin/com/fwdekker/randomness/Matchers.kt rename to src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestMatchers.kt index b4124464a..f6e7c378e 100644 --- a/src/test/kotlin/com/fwdekker/randomness/Matchers.kt +++ b/src/test/kotlin/com/fwdekker/randomness/testhelpers/KotestMatchers.kt @@ -1,5 +1,8 @@ -package com.fwdekker.randomness +package com.fwdekker.randomness.testhelpers +import com.fwdekker.randomness.Bundle +import com.fwdekker.randomness.State +import com.fwdekker.randomness.matchesFormat import io.kotest.assertions.withClue import io.kotest.matchers.Matcher import io.kotest.matchers.MatcherResult @@ -9,8 +12,6 @@ import io.kotest.matchers.nulls.beNull import io.kotest.matchers.should -// TODO: Merge this file with `AssertJHelper`? - /** * @see beEmptyArray */ diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelperTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpersTest.kt similarity index 77% rename from src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelperTest.kt rename to src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpersTest.kt index 6f2551d0a..94b31acaa 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelperTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/InterfaceBuilderHelpersTest.kt @@ -4,8 +4,8 @@ import io.kotest.core.spec.style.FunSpec /** - * Unit tests for extension functions in `InterfaceBuilderHelperKt`. + * Unit tests for extension functions in `InterfaceBuilderHelpersKt`. */ -object InterfaceBuilderHelperTest : FunSpec({ +object InterfaceBuilderHelpersTest : FunSpec({ // TODO: Add these tests }) diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt index a2b7ef1be..8abab2a22 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/JDateTimeFieldTest.kt @@ -1,9 +1,9 @@ package com.fwdekker.randomness.ui import com.fwdekker.randomness.Bundle -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun import com.github.sisyphsu.dateparser.DateParserUtils import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.NamedTag diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt index c5373ae63..da6bae9e2 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/JNumberSpinnerTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness.ui -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun +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 diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/LengthDocumentFiltersTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/LengthDocumentFiltersTest.kt index 380a06fd4..ae396d68b 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/LengthDocumentFiltersTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/LengthDocumentFiltersTest.kt @@ -1,6 +1,6 @@ package com.fwdekker.randomness.ui -import com.fwdekker.randomness.beforeNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.shouldBe diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelperTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt similarity index 94% rename from src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelperTest.kt rename to src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt index eceb7fe16..dd8042064 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelperTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/ListenerHelpersTest.kt @@ -1,9 +1,9 @@ package com.fwdekker.randomness.ui -import com.fwdekker.randomness.DummySchemeEditor -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun +import com.fwdekker.randomness.testhelpers.DummySchemeEditor +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 @@ -27,9 +27,9 @@ import javax.swing.tree.MutableTreeNode /** - * Unit tests for extension functions in `ListenerHelperKt`. + * Unit tests for extension functions in `ListenerHelpersKt`. */ -object ListenerHelperTest : FunSpec({ +object ListenerHelpersTest : FunSpec({ tags(NamedTag("Swing")) diff --git a/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt b/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt index 4957bd8bf..bf75c8c3e 100644 --- a/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/ui/PreviewPanelTest.kt @@ -1,13 +1,13 @@ package com.fwdekker.randomness.ui import com.fwdekker.randomness.Bundle -import com.fwdekker.randomness.DummyScheme -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer -import com.fwdekker.randomness.find -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.matcher +import com.fwdekker.randomness.testhelpers.DummyScheme +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.find +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.matcher import com.intellij.testFramework.fixtures.IdeaTestFixture import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory import com.intellij.ui.InplaceButton diff --git a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt index c4b9b4781..4a5510ee1 100644 --- a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeEditorTest.kt @@ -1,14 +1,14 @@ package com.fwdekker.randomness.uuid -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.isSelectedProp -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.isSelectedProp +import com.fwdekker.randomness.testhelpers.prop +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 com.intellij.ui.dsl.builder.MutableProperty diff --git a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt index 15a7cc8b1..e5935fb43 100644 --- a/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/uuid/UuidSchemeTest.kt @@ -2,8 +2,8 @@ package com.fwdekker.randomness.uuid import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row diff --git a/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt index f5152ec5b..e70c1fca7 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/DefaultWordListTest.kt @@ -1,7 +1,7 @@ package com.fwdekker.randomness.word import com.fwdekker.randomness.Bundle -import com.fwdekker.randomness.beforeNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer import io.kotest.assertions.throwables.shouldThrow import io.kotest.core.spec.style.FunSpec import io.kotest.matchers.collections.beEmpty diff --git a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt index c7e594b75..75ee06c65 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeEditorTest.kt @@ -1,18 +1,18 @@ package com.fwdekker.randomness.word import com.fwdekker.randomness.CapitalizationMode -import com.fwdekker.randomness.afterNonContainer -import com.fwdekker.randomness.beforeNonContainer import com.fwdekker.randomness.editorApplyTestFactory import com.fwdekker.randomness.editorFieldsTestFactory -import com.fwdekker.randomness.find -import com.fwdekker.randomness.guiGet -import com.fwdekker.randomness.guiRun -import com.fwdekker.randomness.itemProp -import com.fwdekker.randomness.matcher -import com.fwdekker.randomness.prop -import com.fwdekker.randomness.textProp -import com.fwdekker.randomness.valueProp +import com.fwdekker.randomness.testhelpers.afterNonContainer +import com.fwdekker.randomness.testhelpers.beforeNonContainer +import com.fwdekker.randomness.testhelpers.find +import com.fwdekker.randomness.testhelpers.guiGet +import com.fwdekker.randomness.testhelpers.guiRun +import com.fwdekker.randomness.testhelpers.itemProp +import com.fwdekker.randomness.testhelpers.matcher +import com.fwdekker.randomness.testhelpers.prop +import com.fwdekker.randomness.testhelpers.textProp +import com.fwdekker.randomness.testhelpers.valueProp import com.intellij.openapi.application.runWriteAction import com.intellij.openapi.editor.impl.EditorComponentImpl import com.intellij.testFramework.fixtures.IdeaTestFixture diff --git a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt index 280429829..9664530fa 100644 --- a/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt +++ b/src/test/kotlin/com/fwdekker/randomness/word/WordSchemeTest.kt @@ -3,8 +3,8 @@ package com.fwdekker.randomness.word import com.fwdekker.randomness.CapitalizationMode import com.fwdekker.randomness.affix.AffixDecorator import com.fwdekker.randomness.array.ArrayDecorator -import com.fwdekker.randomness.shouldValidateAsBundle import com.fwdekker.randomness.stateDeepCopyTestFactory +import com.fwdekker.randomness.testhelpers.shouldValidateAsBundle import io.kotest.core.NamedTag import io.kotest.core.spec.style.FunSpec import io.kotest.data.row