@@ -4,7 +4,6 @@ import org.slf4j.Logger
4
4
import org.slf4j.LoggerFactory
5
5
import kotlin.test.Test
6
6
import kotlin.test.assertEquals
7
- import kotlin.test.assertFailsWith
8
7
import kotlin.test.assertTrue
9
8
10
9
class KTeeTest {
@@ -65,60 +64,4 @@ class KTeeTest {
65
64
outputs.forEach { assertTrue { it.endsWith(" hello myval" + System .lineSeparator()) } }
66
65
}
67
66
68
- @Test
69
- fun `should throw IllegalStateException` () {
70
- assertFailsWith<IllegalStateException > {
71
- KTee .debug = false ; KTee .debug = false }
72
- }
73
-
74
- @Test
75
- fun `should not write to stdout` () {
76
- if (! KTee .debugChanged) KTee .debug = false
77
- assertEquals(" " , trapOut { " myval" .tee() })
78
- }
79
-
80
- @Test
81
- fun `should not evaluate lambda or write to stdout` () {
82
- if (! KTee .debugChanged) KTee .debug = false
83
- assertEquals(" " , trapOut { " myval" .tee { v -> " value is $v " } })
84
- }
85
-
86
- @Test
87
- fun `should not write to logger` () {
88
- if (! KTee .debugChanged) KTee .debug = false
89
- assertTrue(trapErr { " myval" .teeToInfo(logger) } == " " )
90
- }
91
-
92
- @Test
93
- fun `should not log with info level` () {
94
- if (! KTee .debugChanged) KTee .debug = false
95
- val outputs = listOf (
96
- trapErr { " myval" .teeToInfo(logger, " hello {}" ) },
97
- trapErr { " myval" .teeToInfo(logger) { " hello $it " } },
98
- trapErr { " myval" .teeToInfo(logger) { " hello {}" } }
99
- )
100
- outputs.forEach { assertTrue { ! it.contains(" INFO" ) } }
101
- }
102
-
103
- @Test
104
- fun `should not log with trace level` () {
105
- if (! KTee .debugChanged) KTee .debug = false
106
- val outputs = listOf (
107
- trapErr { " myval" .teeToTrace(logger, " hello {}" ) },
108
- trapErr { " myval" .teeToTrace(logger) { " hello $it " } },
109
- trapErr { " myval" .teeToTrace(logger) { " hello {}" } }
110
- )
111
- outputs.forEach { assertTrue { it == " " } }
112
- }
113
-
114
- @Test
115
- fun `should not log with debug level` () {
116
- if (! KTee .debugChanged) KTee .debug = false
117
- val outputs = listOf (
118
- trapErr { " myval" .teeToDebug(logger, " hello {}" ) },
119
- trapErr { " myval" .teeToDebug(logger) { " hello $it " } },
120
- trapErr { " myval" .teeToDebug(logger) { " hello {}" } }
121
- )
122
- outputs.forEach { assertTrue { ! it.contains(" DEBUG" ) } }
123
- }
124
67
}
0 commit comments