Skip to content

Commit

Permalink
Add test for version check
Browse files Browse the repository at this point in the history
  • Loading branch information
phanlezz committed Apr 29, 2024
1 parent 6727a0f commit 220fa56
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,27 @@ private val outContent = ByteArrayOutputStream()
System.setOut(originalOut)
}

@Test
fun `should show version and copyright when executed with version flag`() {
// given
mockkObject(ParserService)
val outStream = ByteArrayOutputStream()
val originalOut = System.out
System.setOut(PrintStream(outStream))

// when
val exitCode = Ccsh.executeCommandLine(arrayOf("-v"))

// then
Assertions.assertThat(exitCode).isEqualTo(0)
Assertions.assertThat(outStream.toString())
.contains(listOf("version", "Copyright(c) 2024, MaibornWolff GmbH\n"))
verify(exactly = 0) { ParserService.executePreconfiguredParser(any(), any()) }

// clean up
System.setOut(originalOut)
}

@Test
fun `should execute parser suggestions and all selected parsers when no options are passed`() {
// given
Expand Down

0 comments on commit 220fa56

Please sign in to comment.