@@ -40,18 +40,22 @@ class ResultsChecker(
40
40
val unexpectedWarnings = actualWarnings - actualMatchedWithExpectedWarnings
41
41
42
42
return when (missingWarnings.isEmpty() to unexpectedWarnings.isEmpty()) {
43
- false to true -> createFailFromSingleMiss(EXPECTED_BUT_NOT_RECEIVED , missingWarnings)
44
- false to false -> createFailFromDoubleMiss(missingWarnings, unexpectedWarnings)
45
- true to true -> Pass (
46
- " $ALL_EXPECTED : ${expectedWarningsMatchedWithActual.size} warnings" ,
43
+ false to true -> Fail (
44
+ " $MISSING $missingWarnings " ,
45
+ " $MISSING (${missingWarnings.size} ). $MATCHED (${expectedWarningsMatchedWithActual.size} )"
47
46
)
47
+ false to false -> createFailFromDoubleMiss(missingWarnings, unexpectedWarnings, expectedWarningsMatchedWithActual)
48
+ true to true -> Pass (" $ALL_EXPECTED (${expectedWarningsMatchedWithActual.size} )" )
48
49
true to false -> if (warnPluginConfig.exactWarningsMatch == false ) {
49
50
Pass (
50
- " $UNEXPECTED : $unexpectedWarnings " ,
51
- " $EXPECTED : ${expectedWarningsMatchedWithActual .size} warnings, $UNEXPECTED : ${unexpectedWarnings .size} warnings "
51
+ " $UNEXPECTED $unexpectedWarnings " ,
52
+ " $UNEXPECTED ( ${unexpectedWarnings .size}). $MATCHED ( ${expectedWarningsMatchedWithActual .size}) "
52
53
)
53
54
} else {
54
- createFailFromSingleMiss(UNEXPECTED , unexpectedWarnings)
55
+ Fail (
56
+ " $UNEXPECTED $unexpectedWarnings " ,
57
+ " $UNEXPECTED (${unexpectedWarnings.size} ). $MATCHED (${expectedWarningsMatchedWithActual.size} )"
58
+ )
55
59
}
56
60
else -> Fail (" N/A" , " N/A" )
57
61
}
@@ -83,19 +87,21 @@ class ResultsChecker(
83
87
matchedWarning != null
84
88
}
85
89
86
- private fun createFailFromSingleMiss (baseText : String , warnings : List <Warning >) =
87
- Fail (" $baseText : $warnings " , " $baseText (${warnings.size} )" )
88
-
89
- private fun createFailFromDoubleMiss (missingWarnings : List <Warning >, unexpectedWarnings : List <Warning >) =
90
- Fail (
91
- " $EXPECTED_BUT_NOT_RECEIVED : $missingWarnings , and ${UNEXPECTED .lowercase()} : $unexpectedWarnings " ,
92
- " $EXPECTED_BUT_NOT_RECEIVED (${missingWarnings.size} ), and ${UNEXPECTED .lowercase()} (${unexpectedWarnings.size} )"
93
- )
90
+ private fun createFailFromDoubleMiss (
91
+ missingWarnings : List <Warning >,
92
+ unexpectedWarnings : List <Warning >,
93
+ matchedWarnings : List <Warning >
94
+ ) = Fail (
95
+ " $MISSING $missingWarnings . $UNEXPECTED $unexpectedWarnings ." ,
96
+ " $MISSING (${missingWarnings.size} ). " +
97
+ " $UNEXPECTED (${unexpectedWarnings.size} ). " +
98
+ " $MATCHED (${matchedWarnings.size} )"
99
+ )
94
100
95
101
companion object {
96
- private const val ALL_EXPECTED = " All warnings were expected "
97
- private const val EXPECTED = " Received expected warnings "
98
- private const val EXPECTED_BUT_NOT_RECEIVED = " Some warnings were expected but not received "
99
- private const val UNEXPECTED = " Some warnings were unexpected "
102
+ private const val ALL_EXPECTED = " (ALL WARNINGS MATCHED): "
103
+ private const val MATCHED = " (MATCHED WARNINGS): "
104
+ private const val MISSING = " (MISSING WARNINGS): "
105
+ private const val UNEXPECTED = " (UNEXPECTED WARNINGS): "
100
106
}
101
107
}
0 commit comments