|
44 | 44 | import java.util.ArrayList;
|
45 | 45 | import java.util.List;
|
46 | 46 | import java.util.Locale;
|
| 47 | +import java.util.TimeZone; |
47 | 48 |
|
48 | 49 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
49 | 50 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
@@ -79,8 +80,20 @@ public void testContentLengthConverter() {
|
79 | 80 | }
|
80 | 81 |
|
81 | 82 | @Test
|
82 |
| - public void testDateConverter() { |
83 |
| - dateConverterChecker(parseDateAsMillis("2024-08-14T15:29:25.956Z"), List.of(), "14/.../2024:17:29:25 \\+\\d*"); |
| 83 | + public void testDateConverterWithDefaultTimezone() { |
| 84 | + TimeZone originalTimeZone = TimeZone.getDefault(); |
| 85 | + try { |
| 86 | + // Set a known timezone for deterministic testing |
| 87 | + TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); |
| 88 | + dateConverterChecker(parseDateAsMillis("2024-08-14T15:29:25.956Z"), List.of(), "14/.../2024:17:29:25 \\+\\d*"); |
| 89 | + } finally { |
| 90 | + // Restore original timezone |
| 91 | + TimeZone.setDefault(originalTimeZone); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + @Test |
| 96 | + public void testDateConverterWithExplicitTimezone() { |
84 | 97 | dateConverterChecker(parseDateAsMillis("2022-10-21T10:30:20.800Z"), List.of(CoreConstants.CLF_DATE_PATTERN, "Australia/Sydney", "en-AU"),
|
85 | 98 | "21/Oct/2022:21:30:20 \\+1100");
|
86 | 99 | dateConverterChecker(parseDateAsMillis("2022-09-21T10:30:20.800Z"), List.of(CoreConstants.CLF_DATE_PATTERN, "UTC", "en"),
|
@@ -111,6 +124,7 @@ void dateConverterChecker(long millis, List<String> options, String regex) {
|
111 | 124 | assertTrue(result.matches(regex));
|
112 | 125 | }
|
113 | 126 |
|
| 127 | + @Test |
114 | 128 | public void testLineLocalPortConverter() {
|
115 | 129 | LocalPortConverter converter = new LocalPortConverter();
|
116 | 130 | converter.start();
|
|
0 commit comments