11package io .prometheus .metrics .model .snapshots ;
22
3+ import org .junit .jupiter .api .AfterEach ;
4+ import org .junit .jupiter .api .Test ;
5+ import org .junit .jupiter .params .ParameterizedTest ;
6+ import org .junit .jupiter .params .provider .Arguments ;
7+ import org .junit .jupiter .params .provider .CsvSource ;
8+ import org .junit .jupiter .params .provider .MethodSource ;
9+ import org .junitpioneer .jupiter .SetSystemProperty ;
10+
11+ import java .util .stream .Stream ;
12+
313import static io .prometheus .metrics .model .snapshots .PrometheusNaming .escapeMetricSnapshot ;
414import static io .prometheus .metrics .model .snapshots .PrometheusNaming .escapeName ;
515import static io .prometheus .metrics .model .snapshots .PrometheusNaming .isValidLabelName ;
1323import static org .assertj .core .api .Assertions .assertThat ;
1424import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
1525
16- import java .util .stream .Stream ;
17- import org .junit .jupiter .api .AfterEach ;
18- import org .junit .jupiter .api .Test ;
19- import org .junit .jupiter .params .ParameterizedTest ;
20- import org .junit .jupiter .params .provider .Arguments ;
21- import org .junit .jupiter .params .provider .CsvSource ;
22- import org .junit .jupiter .params .provider .MethodSource ;
23- import org .junitpioneer .jupiter .SetSystemProperty ;
24-
2526class PrometheusNamingTest {
2627
2728 @ AfterEach
@@ -296,7 +297,7 @@ static Stream<Arguments> escapeNameUtf8TestCases() {
296297 @ CsvSource (
297298 value = {
298299 // empty string
299- ", " ,
300+ "'','' " ,
300301 // basic case, no error
301302 "U__no:unescapingrequired,no:unescapingrequired" ,
302303 // capitals ok, no error
@@ -317,12 +318,6 @@ static Stream<Arguments> escapeNameUtf8TestCases() {
317318 "U__bad__utf_D900_,U__bad__utf_D900_" ,
318319 })
319320 public void testValueUnescapeErrors (String escapedName , String expectedUnescapedName ) {
320- if (escapedName == null ) {
321- escapedName = "" ;
322- }
323- if (expectedUnescapedName == null ) {
324- expectedUnescapedName = "" ;
325- }
326321 assertThat (unescapeName (escapedName , EscapingScheme .VALUE_ENCODING_ESCAPING ))
327322 .isEqualTo (expectedUnescapedName );
328323 }
0 commit comments