Skip to content

Commit c46b89d

Browse files
committed
Fix location-based tests
1 parent 6709cd1 commit c46b89d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void builder() {
133133
final List<LogEvent> events = app.getEvents();
134134
assertEventCount(events, 3);
135135
assertEquals(
136-
"org.apache.logging.log4j.core.LoggerTest.builder(LoggerTest.java:123)",
136+
"org.apache.logging.log4j.core.LoggerTest.builder(LoggerTest.java:129)",
137137
events.get(0).getSource().toString(),
138138
"Incorrect location");
139139
assertEquals(Level.DEBUG, events.get(0).getLevel(), "Incorrect Level");

log4j-core-test/src/test/java/org/apache/logging/log4j/core/PatternSelectorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void testMarkerPatternSelector(@Named("List") final ListAppender app) {
5050
final String expect = String.format(
5151
"[TRACE] TestMarkerPatternSelector ====== "
5252
+ "o.a.l.l.c.PatternSelectorTest.testMarkerPatternSelector:%d Enter ======%n",
53-
CURRENT_LINE + 4);
53+
CURRENT_LINE + 5);
5454
assertEquals(expect, messages.get(0));
5555
assertEquals("[INFO ] TestMarkerPatternSelector Hello World" + Strings.LINE_SEPARATOR, messages.get(1));
5656
app.clear();
@@ -73,12 +73,12 @@ public void testScriptPatternSelector(@Named("List2") final ListAppender app) {
7373
String expect = String.format(
7474
"[TRACE] TestScriptPatternSelector ====== "
7575
+ "o.a.l.l.c.PatternSelectorTest.testScriptPatternSelector:%d Enter ======%n",
76-
CURRENT_LINE + 26);
76+
CURRENT_LINE + 27);
7777
assertEquals(expect, messages.get(0));
7878
expect = String.format(
7979
"[INFO ] TestScriptPatternSelector o.a.l.l.c.PatternSelectorTest.testScriptPatternSelector.%d "
8080
+ "Hello World%n",
81-
CURRENT_LINE + 27);
81+
CURRENT_LINE + 28);
8282
assertEquals(expect, messages.get(1));
8383
assertEquals("[INFO ] NoLocation No location information" + Strings.LINE_SEPARATOR, messages.get(2));
8484
app.clear();
@@ -101,12 +101,12 @@ public void testJavaScriptPatternSelector(@Named("List3") final ListAppender app
101101
String expect = String.format(
102102
"[TRACE] TestJavaScriptPatternSelector ====== "
103103
+ "o.a.l.l.c.PatternSelectorTest.testJavaScriptPatternSelector:%d Enter ======%n",
104-
CURRENT_LINE + 54);
104+
CURRENT_LINE + 55);
105105
assertEquals(expect, messages.get(0));
106106
expect = String.format(
107107
"[INFO ] TestJavaScriptPatternSelector "
108108
+ "o.a.l.l.c.PatternSelectorTest.testJavaScriptPatternSelector.%d Hello World%n",
109-
CURRENT_LINE + 55);
109+
CURRENT_LINE + 56);
110110
assertEquals(expect, messages.get(1));
111111
assertEquals("[INFO ] JavascriptNoLocation No location information" + Strings.LINE_SEPARATOR, messages.get(2));
112112
app.clear();

log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/MemoryMappedFileAppenderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void testMemMapLocation(final LoggerContext context) throws Exception {
118118
both(hasSize(2))
119119
.and(
120120
contains(
121-
"org.apache.logging.log4j.core.appender.MemoryMappedFileAppenderTest.testMemMapLocation(MemoryMappedFileAppenderTest.java:103): Test log1",
122-
"org.apache.logging.log4j.core.appender.MemoryMappedFileAppenderTest.testMemMapLocation(MemoryMappedFileAppenderTest.java:106): Test log2")));
121+
"org.apache.logging.log4j.core.appender.MemoryMappedFileAppenderTest.testMemMapLocation(MemoryMappedFileAppenderTest.java:105): Test log1",
122+
"org.apache.logging.log4j.core.appender.MemoryMappedFileAppenderTest.testMemMapLocation(MemoryMappedFileAppenderTest.java:108): Test log2")));
123123
}
124124
}

log4j-core-test/src/test/java/org/apache/logging/log4j/core/pattern/PatternParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void testCustomPattern() {
115115
formatter.format(event, buf);
116116
}
117117
final String str = buf.toString();
118-
final String expected = "INFO [PatternParserTest :98 ] - Hello, world" + Strings.LINE_SEPARATOR;
118+
final String expected = "INFO [PatternParserTest :100 ] - Hello, world" + Strings.LINE_SEPARATOR;
119119
assertTrue(str.endsWith(expected), "Expected to end with: " + expected + ". Actual: " + str);
120120
}
121121

0 commit comments

Comments
 (0)