Skip to content

Commit c17d540

Browse files
Final update
1 parent 5381250 commit c17d540

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

app/test/processing/app/MessagesTest.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@ import java.io.*
88
class MessagesTest {
99
@Test
1010
fun showMessage() {
11-
// Mock output state; instead of output to terminal -> output to a data stream (byte array)
12-
val streamOut = ByteArrayOutputStream()
13-
System.setOut(PrintStream(streamOut))
11+
mockStatic(Base::class.java).use {
12+
mocked -> mocked.`when`<Boolean> { Base.isCommandLine() }.thenReturn(true)
1413

15-
Messages.showMessage("TestTile: ", "Hello World!")
16-
val testOutput
14+
val streamOut = ByteArrayOutputStream()
15+
System.setOut(PrintStream(streamOut))
1716

18-
assertEquals()
17+
Messages.showMessage("TestTitle", "Hello World!")
18+
val testOutput = streamOut.toString()
19+
20+
assertTrue(testOutput.contains("TestTitle: Hello World!"))
21+
}
1922
}
2023

2124
@Test
@@ -52,15 +55,15 @@ class MessagesTest {
5255
}
5356

5457
@Test
55-
fun log() {
58+
fun testLog1() {
5659
}
5760

5861
@Test
59-
fun testLog() {
62+
fun testLog2() {
6063
}
6164

6265
@Test
63-
fun logf() {
66+
fun testLogF() {
6467
}
6568

6669
@Test

0 commit comments

Comments
 (0)