diff --git a/src/test/kotlin/application/MainTest.kt b/src/test/kotlin/application/MainTest.kt index 97b30a8..81a017c 100644 --- a/src/test/kotlin/application/MainTest.kt +++ b/src/test/kotlin/application/MainTest.kt @@ -13,17 +13,16 @@ import org.junit.Test import org.junit.contrib.java.lang.system.ExpectedSystemExit import org.junit.contrib.java.lang.system.SystemErrRule import org.junit.contrib.java.lang.system.SystemOutRule -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import terminal.TerminalConfiguration import terminal.VirtualTerminalInteractor +import testutil.LispTestInstance import testutil.SymbolAndFunctionCleaner import java.io.PipedInputStream import java.io.PipedOutputStream import java.text.MessageFormat.format import java.util.concurrent.CountDownLatch -@TestInstance(PER_CLASS) +@LispTestInstance class MainTest : SymbolAndFunctionCleaner() { companion object { diff --git a/src/test/kotlin/environment/RuntimeEnvironmentTest.kt b/src/test/kotlin/environment/RuntimeEnvironmentTest.kt index 8af572d..9b8104b 100644 --- a/src/test/kotlin/environment/RuntimeEnvironmentTest.kt +++ b/src/test/kotlin/environment/RuntimeEnvironmentTest.kt @@ -5,10 +5,10 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance -@TestInstance(PER_CLASS) + +@LispTestInstance class RuntimeEnvironmentTest { companion object { diff --git a/src/test/kotlin/error/ErrorManagerTest.kt b/src/test/kotlin/error/ErrorManagerTest.kt index 130e615..eac96a5 100644 --- a/src/test/kotlin/error/ErrorManagerTest.kt +++ b/src/test/kotlin/error/ErrorManagerTest.kt @@ -8,12 +8,12 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import java.io.ByteArrayOutputStream import java.io.PrintStream -@TestInstance(PER_CLASS) +@LispTestInstance class ErrorManagerTest { companion object { diff --git a/src/test/kotlin/file/FilePositionTrackerTest.kt b/src/test/kotlin/file/FilePositionTrackerTest.kt index 0f77544..f206332 100644 --- a/src/test/kotlin/file/FilePositionTrackerTest.kt +++ b/src/test/kotlin/file/FilePositionTrackerTest.kt @@ -3,10 +3,9 @@ package file import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class FilePositionTrackerTest { companion object { diff --git a/src/test/kotlin/function/ArgumentValidatorTest.kt b/src/test/kotlin/function/ArgumentValidatorTest.kt index f69f30f..eb27307 100644 --- a/src/test/kotlin/function/ArgumentValidatorTest.kt +++ b/src/test/kotlin/function/ArgumentValidatorTest.kt @@ -7,17 +7,16 @@ import function.ArgumentValidator.TooManyArgumentsException import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Cons import sexpression.LispString import sexpression.Nil import sexpression.SExpression import sexpression.Symbol import sexpression.Symbol.Companion.T +import testutil.LispTestInstance import testutil.TestUtilities.assertIsErrorWithMessage -@TestInstance(PER_CLASS) +@LispTestInstance class ArgumentValidatorTest { companion object { diff --git a/src/test/kotlin/function/LispFunctionTest.kt b/src/test/kotlin/function/LispFunctionTest.kt index 8c16459..d6b9ef1 100644 --- a/src/test/kotlin/function/LispFunctionTest.kt +++ b/src/test/kotlin/function/LispFunctionTest.kt @@ -2,12 +2,11 @@ package function import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Cons import sexpression.Nil +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class LispFunctionTest { @Test diff --git a/src/test/kotlin/function/LispSpecialFunctionTest.kt b/src/test/kotlin/function/LispSpecialFunctionTest.kt index 86c5bfe..3101f26 100644 --- a/src/test/kotlin/function/LispSpecialFunctionTest.kt +++ b/src/test/kotlin/function/LispSpecialFunctionTest.kt @@ -2,12 +2,11 @@ package function import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Cons import sexpression.Nil +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class LispSpecialFunctionTest { @Test diff --git a/src/test/kotlin/function/UserDefinedFunctionTest.kt b/src/test/kotlin/function/UserDefinedFunctionTest.kt index 660bb5c..1aa250e 100644 --- a/src/test/kotlin/function/UserDefinedFunctionTest.kt +++ b/src/test/kotlin/function/UserDefinedFunctionTest.kt @@ -6,16 +6,15 @@ import function.UserDefinedFunction.IllegalKeywordRestPositionException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Cons import sexpression.LispNumber import sexpression.Nil import sexpression.Symbol +import testutil.LispTestInstance import testutil.TestUtilities.assertIsErrorWithMessage import testutil.TestUtilities.assertSExpressionsMatch -@TestInstance(PER_CLASS) +@LispTestInstance class UserDefinedFunctionTest { companion object { diff --git a/src/test/kotlin/function/builtin/EvalTest.kt b/src/test/kotlin/function/builtin/EvalTest.kt index a1bd465..198200a 100644 --- a/src/test/kotlin/function/builtin/EvalTest.kt +++ b/src/test/kotlin/function/builtin/EvalTest.kt @@ -13,17 +13,16 @@ import function.builtin.special.RECUR.RecurNotInTailPositionException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import org.junit.jupiter.api.fail import sexpression.Nil +import testutil.LispTestInstance import testutil.SymbolAndFunctionCleaner import testutil.TestUtilities.assertIsErrorWithMessage import testutil.TestUtilities.assertSExpressionsMatch import testutil.TestUtilities.evaluateString import testutil.TestUtilities.parseString -@TestInstance(PER_CLASS) +@LispTestInstance class EvalTest : SymbolAndFunctionCleaner() { @Test diff --git a/src/test/kotlin/function/builtin/ExitTest.kt b/src/test/kotlin/function/builtin/ExitTest.kt index 53adbbf..d2a7bb4 100644 --- a/src/test/kotlin/function/builtin/ExitTest.kt +++ b/src/test/kotlin/function/builtin/ExitTest.kt @@ -5,12 +5,12 @@ import function.ArgumentValidator.TooManyArgumentsException import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import testutil.SymbolAndFunctionCleaner import testutil.TestUtilities.evaluateString -@TestInstance(PER_CLASS) +@LispTestInstance class ExitTest : SymbolAndFunctionCleaner() { companion object { diff --git a/src/test/kotlin/function/builtin/predicate/NumericEqualTest.kt b/src/test/kotlin/function/builtin/predicate/NumericEqualTest.kt index 8a791db..b0d651f 100644 --- a/src/test/kotlin/function/builtin/predicate/NumericEqualTest.kt +++ b/src/test/kotlin/function/builtin/predicate/NumericEqualTest.kt @@ -4,14 +4,14 @@ import function.ArgumentValidator.BadArgumentTypeException import function.ArgumentValidator.TooFewArgumentsException import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import testutil.SymbolAndFunctionCleaner import testutil.TestUtilities.evaluateString import testutil.TypeAssertions.assertNil import testutil.TypeAssertions.assertT -@TestInstance(PER_CLASS) +@LispTestInstance class NumericEqualTest : SymbolAndFunctionCleaner() { @Test diff --git a/src/test/kotlin/interpreter/LispInterpreterTest.kt b/src/test/kotlin/interpreter/LispInterpreterTest.kt index fef63e3..a3b1865 100644 --- a/src/test/kotlin/interpreter/LispInterpreterTest.kt +++ b/src/test/kotlin/interpreter/LispInterpreterTest.kt @@ -6,13 +6,13 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import testutil.TestUtilities.createInputStreamFromString import java.io.ByteArrayOutputStream import java.io.PrintStream -@TestInstance(PER_CLASS) +@LispTestInstance class LispInterpreterTest { companion object { diff --git a/src/test/kotlin/parser/LispParserTest.kt b/src/test/kotlin/parser/LispParserTest.kt index 5ddc279..0607309 100644 --- a/src/test/kotlin/parser/LispParserTest.kt +++ b/src/test/kotlin/parser/LispParserTest.kt @@ -5,10 +5,9 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import scanner.LispScanner.UnterminatedStringException import stream.LispIOException +import testutil.LispTestInstance import testutil.TestUtilities.assertIsErrorWithMessage import testutil.TestUtilities.createIOExceptionThrowingInputStream import testutil.TestUtilities.createInputStreamFromString @@ -24,7 +23,7 @@ import token.Eof.EofEncounteredException import token.RightParenthesis.StartsWithRightParenthesisException import token.TokenFactory.BadCharacterException -@TestInstance(PER_CLASS) +@LispTestInstance class LispParserTest { private fun createLispParser(input: String) = LispParser(createInputStreamFromString(input), "testFile") diff --git a/src/test/kotlin/recursion/TailCallTest.kt b/src/test/kotlin/recursion/TailCallTest.kt index 5bc23fd..f5c6316 100644 --- a/src/test/kotlin/recursion/TailCallTest.kt +++ b/src/test/kotlin/recursion/TailCallTest.kt @@ -2,11 +2,10 @@ package recursion import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import recursion.TailCalls.done +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class TailCallTest { @Test diff --git a/src/test/kotlin/scanner/LispCommentRemovingInputStreamTest.kt b/src/test/kotlin/scanner/LispCommentRemovingInputStreamTest.kt index f18f89c..4961ece 100644 --- a/src/test/kotlin/scanner/LispCommentRemovingInputStreamTest.kt +++ b/src/test/kotlin/scanner/LispCommentRemovingInputStreamTest.kt @@ -4,14 +4,13 @@ import error.Severity.CRITICAL import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import scanner.LispInputStream.MaximumUnreadsExceededException import stream.LispIOException +import testutil.LispTestInstance import testutil.TestUtilities.createIOExceptionThrowingInputStream import testutil.TestUtilities.createInputStreamFromString -@TestInstance(PER_CLASS) +@LispTestInstance class LispCommentRemovingInputStreamTest { private fun getLispCommentRemovingInputStreamResult(inputString: String) = diff --git a/src/test/kotlin/scanner/LispScannerLineColumnTest.kt b/src/test/kotlin/scanner/LispScannerLineColumnTest.kt index e41c803..0ffb0c3 100644 --- a/src/test/kotlin/scanner/LispScannerLineColumnTest.kt +++ b/src/test/kotlin/scanner/LispScannerLineColumnTest.kt @@ -3,11 +3,11 @@ package scanner import file.FilePosition import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import testutil.TestUtilities.createInputStreamFromString -@TestInstance(PER_CLASS) +@LispTestInstance class LispScannerLineColumnTest { companion object { diff --git a/src/test/kotlin/scanner/LispScannerTextTest.kt b/src/test/kotlin/scanner/LispScannerTextTest.kt index 8f2dcbb..57751ed 100644 --- a/src/test/kotlin/scanner/LispScannerTextTest.kt +++ b/src/test/kotlin/scanner/LispScannerTextTest.kt @@ -2,11 +2,11 @@ package scanner import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import testutil.TestUtilities.createInputStreamFromString -@TestInstance(PER_CLASS) +@LispTestInstance class LispScannerTextTest { private fun assertTokenTextMatches(input: String, expectedText: Array) { diff --git a/src/test/kotlin/scanner/LispScannerTypeTest.kt b/src/test/kotlin/scanner/LispScannerTypeTest.kt index cbfecc6..f247d15 100644 --- a/src/test/kotlin/scanner/LispScannerTypeTest.kt +++ b/src/test/kotlin/scanner/LispScannerTypeTest.kt @@ -4,9 +4,8 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import scanner.LispScanner.UnterminatedStringException +import testutil.LispTestInstance import testutil.TestUtilities.assertIsErrorWithMessage import testutil.TestUtilities.createInputStreamFromString import token.AtSign @@ -22,7 +21,7 @@ import token.RightParenthesis import token.Token import token.TokenFactory.BadCharacterException -@TestInstance(PER_CLASS) +@LispTestInstance class LispScannerTypeTest { private val expectedTypes = mutableListOf>() diff --git a/src/test/kotlin/sexpression/SExpressionTest.kt b/src/test/kotlin/sexpression/SExpressionTest.kt index 4387442..b5e5471 100644 --- a/src/test/kotlin/sexpression/SExpressionTest.kt +++ b/src/test/kotlin/sexpression/SExpressionTest.kt @@ -4,16 +4,15 @@ import function.UserDefinedFunction import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.LispNumber.InvalidNumberException +import testutil.LispTestInstance import testutil.TestUtilities.assertIsErrorWithMessage import testutil.TestUtilities.assertSExpressionsMatch import testutil.TestUtilities.makeList import java.math.BigInteger import java.util.Locale -@TestInstance(PER_CLASS) +@LispTestInstance class SExpressionTest { private fun assertSExpressionMatchesString(expected: String, sExpression: SExpression) { diff --git a/src/test/kotlin/stream/SafeInputStreamTest.kt b/src/test/kotlin/stream/SafeInputStreamTest.kt index 32ab168..0acd5f4 100644 --- a/src/test/kotlin/stream/SafeInputStreamTest.kt +++ b/src/test/kotlin/stream/SafeInputStreamTest.kt @@ -4,13 +4,12 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance import testutil.TestUtilities.createIOExceptionThrowingInputStream import testutil.TestUtilities.createInputStreamFromString import util.Characters.EOF -@TestInstance(PER_CLASS) +@LispTestInstance class SafeInputStreamTest { private lateinit var safe: SafeInputStream diff --git a/src/test/kotlin/stream/SafeOutputStreamTest.kt b/src/test/kotlin/stream/SafeOutputStreamTest.kt index af69d46..377ff02 100644 --- a/src/test/kotlin/stream/SafeOutputStreamTest.kt +++ b/src/test/kotlin/stream/SafeOutputStreamTest.kt @@ -4,12 +4,11 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance import testutil.TestUtilities.createIOExceptionThrowingOutputStream import java.io.ByteArrayOutputStream -@TestInstance(PER_CLASS) +@LispTestInstance class SafeOutputStreamTest { private lateinit var safe: SafeOutputStream diff --git a/src/test/kotlin/table/ExecutionContextTest.kt b/src/test/kotlin/table/ExecutionContextTest.kt index 72235eb..3606497 100644 --- a/src/test/kotlin/table/ExecutionContextTest.kt +++ b/src/test/kotlin/table/ExecutionContextTest.kt @@ -4,13 +4,12 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Nil import sexpression.Symbol.Companion.T import table.SymbolTable.NullSymbolTable +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class ExecutionContextTest { @BeforeEach diff --git a/src/test/kotlin/table/FunctionTableTest.kt b/src/test/kotlin/table/FunctionTableTest.kt index 87d9ceb..5bf20dc 100644 --- a/src/test/kotlin/table/FunctionTableTest.kt +++ b/src/test/kotlin/table/FunctionTableTest.kt @@ -8,8 +8,6 @@ import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Cons import sexpression.LispString import sexpression.Nil @@ -19,8 +17,9 @@ import table.FunctionTable.defineFunction import table.FunctionTable.isAlreadyDefined import table.FunctionTable.lookupFunction import table.FunctionTable.resetFunctionTable +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class FunctionTableTest { @FunctionNames("GOOD") diff --git a/src/test/kotlin/table/SymbolTableTest.kt b/src/test/kotlin/table/SymbolTableTest.kt index fb1aeea..304e12f 100644 --- a/src/test/kotlin/table/SymbolTableTest.kt +++ b/src/test/kotlin/table/SymbolTableTest.kt @@ -3,12 +3,11 @@ package table import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import sexpression.Nil import sexpression.Symbol.Companion.T +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class SymbolTableTest { private lateinit var symbolTable: SymbolTable diff --git a/src/test/kotlin/terminal/ControlSequenceHandlerTest.kt b/src/test/kotlin/terminal/ControlSequenceHandlerTest.kt index 298f3a9..b11f2c0 100644 --- a/src/test/kotlin/terminal/ControlSequenceHandlerTest.kt +++ b/src/test/kotlin/terminal/ControlSequenceHandlerTest.kt @@ -3,8 +3,6 @@ package terminal import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import stream.SafeInputStream import terminal.ControlSequence.NullControlSequence import terminal.ControlSequenceHandler.Companion.isEscape @@ -13,10 +11,11 @@ import terminal.SelectGraphicRendition.PURPLE import terminal.SelectGraphicRendition.RED import terminal.SelectGraphicRendition.RESET import terminal.SelectGraphicRendition.YELLOW +import testutil.LispTestInstance import testutil.TestUtilities import util.Characters.EOF -@TestInstance(PER_CLASS) +@LispTestInstance class ControlSequenceHandlerTest { private lateinit var handler: ControlSequenceHandler diff --git a/src/test/kotlin/terminal/ControlSequenceTest.kt b/src/test/kotlin/terminal/ControlSequenceTest.kt index 4d24a6d..137d68d 100644 --- a/src/test/kotlin/terminal/ControlSequenceTest.kt +++ b/src/test/kotlin/terminal/ControlSequenceTest.kt @@ -6,17 +6,16 @@ import com.googlecode.lanterna.terminal.virtual.VirtualTerminal import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import terminal.ControlSequence.NullControlSequence import terminal.SelectGraphicRendition.GREEN import terminal.SelectGraphicRendition.PURPLE import terminal.SelectGraphicRendition.RED import terminal.SelectGraphicRendition.RESET import terminal.SelectGraphicRendition.YELLOW +import testutil.LispTestInstance import java.util.HashSet -@TestInstance(PER_CLASS) +@LispTestInstance class ControlSequenceTest { private lateinit var indicatorSet: MutableSet diff --git a/src/test/kotlin/terminal/LispTerminalTest.kt b/src/test/kotlin/terminal/LispTerminalTest.kt index 60756e5..a1ec7a5 100644 --- a/src/test/kotlin/terminal/LispTerminalTest.kt +++ b/src/test/kotlin/terminal/LispTerminalTest.kt @@ -11,11 +11,10 @@ import com.googlecode.lanterna.input.KeyType.Escape import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import terminal.LispTerminal.Companion.END_OF_SEGMENT +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class LispTerminalTest { private lateinit var terminal: VirtualTerminalInteractor diff --git a/src/test/kotlin/terminal/TerminalConfigurationTest.kt b/src/test/kotlin/terminal/TerminalConfigurationTest.kt index bc5a6a6..9a0304e 100644 --- a/src/test/kotlin/terminal/TerminalConfigurationTest.kt +++ b/src/test/kotlin/terminal/TerminalConfigurationTest.kt @@ -3,14 +3,13 @@ package terminal import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS import stream.LispIOException +import testutil.LispTestInstance import java.io.IOException import java.io.PipedInputStream import java.io.PipedOutputStream -@TestInstance(PER_CLASS) +@LispTestInstance class TerminalConfigurationTest { private lateinit var configuration: TerminalConfiguration diff --git a/src/test/kotlin/terminal/TerminalHistoryTest.kt b/src/test/kotlin/terminal/TerminalHistoryTest.kt index fca32ea..d603b25 100644 --- a/src/test/kotlin/terminal/TerminalHistoryTest.kt +++ b/src/test/kotlin/terminal/TerminalHistoryTest.kt @@ -4,10 +4,9 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance -@TestInstance(PER_CLASS) +@LispTestInstance class TerminalHistoryTest { private lateinit var history: TerminalHistory diff --git a/src/test/kotlin/testutil/LispTestInstance.kt b/src/test/kotlin/testutil/LispTestInstance.kt new file mode 100644 index 0000000..8e92ee5 --- /dev/null +++ b/src/test/kotlin/testutil/LispTestInstance.kt @@ -0,0 +1,9 @@ +package testutil + +import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import kotlin.annotation.AnnotationTarget.CLASS + +@Target(CLASS) +@TestInstance(PER_CLASS) +annotation class LispTestInstance diff --git a/src/test/kotlin/token/TokenFactoryTest.kt b/src/test/kotlin/token/TokenFactoryTest.kt index bfd718a..af458cb 100644 --- a/src/test/kotlin/token/TokenFactoryTest.kt +++ b/src/test/kotlin/token/TokenFactoryTest.kt @@ -6,12 +6,12 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import org.junit.jupiter.api.TestInstance -import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS +import testutil.LispTestInstance + import token.TokenFactory.BadCharacterException import token.TokenFactory.EmptyTokenTextException -@TestInstance(PER_CLASS) +@LispTestInstance class TokenFactoryTest { private lateinit var tokenFactory: TokenFactory @@ -80,7 +80,7 @@ class TokenFactoryTest { try { createToken("") } catch (e: EmptyTokenTextException) { - assertThat(e.message).isNotEmpty(); + assertThat(e.message).isNotEmpty() assertThat(e.severity).isEqualTo(CRITICAL) } }