Skip to content

Commit 8bd5660

Browse files
committed
modify VersionCheckTest to use logback-core 1.5.25
Signed-off-by: ceki <[email protected]>
1 parent 7a8f0b6 commit 8bd5660

3 files changed

Lines changed: 44 additions & 5 deletions

File tree

logback-classic-blackbox/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
<profile>
131131
<id>older-core</id>
132132
<properties>
133-
<older-logback-core.version>1.5.20</older-logback-core.version>
133+
<older-logback-core.version>1.5.25</older-logback-core.version>
134134
</properties>
135135
<dependencyManagement>
136136
<dependencies>

logback-classic-blackbox/src/test/java/ch/qos/logback/classic/blackbox/VersionCheckTest.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
package ch.qos.logback.classic.blackbox;
1616

17-
import ch.qos.logback.classic.ClassicConstants;
1817
import ch.qos.logback.classic.LoggerContext;
1918
import ch.qos.logback.core.CoreConstants;
19+
import ch.qos.logback.core.util.CoreVersionUtil;
2020
import ch.qos.logback.core.util.VersionUtil;
21+
import org.junit.jupiter.api.Disabled;
2122
import org.junit.jupiter.api.Test;
2223

2324
import static org.junit.jupiter.api.Assertions.assertEquals;
24-
import static org.junit.jupiter.api.Assertions.assertNotNull;
25-
import static org.junit.jupiter.api.Assertions.assertTrue;
2625
import static org.junit.jupiter.api.Assertions.fail;
2726

2827
/**
@@ -59,9 +58,11 @@ public class VersionCheckTest {
5958
* 1.5.25 or older.
6059
*/
6160
@Test
61+
@Disabled
6262
public void versionTest() {
6363
String olderCoreVersion = System.getProperty("olderCore", "none");
64-
assertEquals("1.5.20", olderCoreVersion);
64+
//assertEquals("1.5.20", olderCoreVersion);
65+
assertEquals("1.5.25", olderCoreVersion);
6566
try {
6667
VersionUtil.checkForVersionEquality(loggerContext, this.getClass(), CoreConstants.class, "logback-classic", "logback-core");
6768
fail("Expected NoClassDefFoundError");
@@ -71,6 +72,26 @@ public void versionTest() {
7172
}
7273
}
7374

75+
@Test
76+
public void otherVersionTest() {
77+
String olderCoreVersion = System.getProperty("olderCore", "none");
78+
//assertEquals("1.5.20", olderCoreVersion);
79+
assertEquals("1.5.25", olderCoreVersion);
80+
try {
81+
CoreVersionUtil.getCoreVersionBySelfDeclaredProperties();
82+
fail("Expected Error");
83+
} catch (NoClassDefFoundError e) {
84+
// logback-core version is 1.5.24 or older
85+
System.out.println("Got expected NoClassDefFoundError.");
86+
} catch (NoSuchMethodError e) {
87+
// logback-core version is 1.5.25 or older
88+
System.out.println("Got expected NoSuchFieldError.");
89+
}
90+
}
91+
92+
93+
94+
7495
// WARNING: do not add other tests to this file
7596

7697
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2026, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
15+
package ch.qos.logback.core.util;
16+
17+
public class CoreVersionUtil {
18+
}

0 commit comments

Comments
 (0)