|
16 | 16 | */
|
17 | 17 | package org.apache.log4j;
|
18 | 18 |
|
19 |
| -import static org.junit.Assert.assertEquals; |
20 |
| -import static org.junit.Assert.assertFalse; |
21 |
| -import static org.junit.Assert.assertTrue; |
| 19 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 20 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
| 21 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
22 | 22 |
|
23 | 23 | import java.util.Locale;
|
24 |
| -import org.junit.Test; |
| 24 | +import java.util.stream.Stream; |
| 25 | +import org.junit.jupiter.api.Test; |
| 26 | +import org.junit.jupiter.params.ParameterizedTest; |
| 27 | +import org.junit.jupiter.params.provider.Arguments; |
| 28 | +import org.junit.jupiter.params.provider.MethodSource; |
25 | 29 |
|
26 | 30 | /**
|
27 | 31 | * Tests of Priority.
|
@@ -85,49 +89,23 @@ public void testAllInt() {
|
85 | 89 | assertEquals(Integer.MIN_VALUE, Priority.ALL_INT);
|
86 | 90 | }
|
87 | 91 |
|
88 |
| - /** |
89 |
| - * Tests Priority.FATAL version2Level. |
90 |
| - */ |
91 |
| - @Test |
92 |
| - @SuppressWarnings("deprecation") |
93 |
| - public void testFatalVersion2Level() { |
94 |
| - assertEquals(org.apache.logging.log4j.Level.FATAL, Priority.FATAL.getVersion2Level()); |
95 |
| - } |
96 |
| - |
97 |
| - /** |
98 |
| - * Tests Priority.ERROR version2Level. |
99 |
| - */ |
100 |
| - @Test |
101 | 92 | @SuppressWarnings("deprecation")
|
102 |
| - public void testErrorVersion2Level() { |
103 |
| - assertEquals(org.apache.logging.log4j.Level.ERROR, Priority.ERROR.getVersion2Level()); |
| 93 | + static Stream<Arguments> testVersion2Level() { |
| 94 | + return Stream.of( |
| 95 | + Arguments.of(Priority.FATAL, org.apache.logging.log4j.Level.FATAL), |
| 96 | + Arguments.of(Priority.ERROR, org.apache.logging.log4j.Level.ERROR), |
| 97 | + Arguments.of(Priority.WARN, org.apache.logging.log4j.Level.WARN), |
| 98 | + Arguments.of(Priority.INFO, org.apache.logging.log4j.Level.INFO), |
| 99 | + Arguments.of(Priority.DEBUG, org.apache.logging.log4j.Level.DEBUG)); |
104 | 100 | }
|
105 | 101 |
|
106 | 102 | /**
|
107 |
| - * Tests Priority.WARN version2Level. |
| 103 | + * Tests version2Level. |
108 | 104 | */
|
109 |
| - @Test |
110 |
| - @SuppressWarnings("deprecation") |
111 |
| - public void testWarnVersion2Level() { |
112 |
| - assertEquals(org.apache.logging.log4j.Level.WARN, Priority.WARN.getVersion2Level()); |
113 |
| - } |
114 |
| - |
115 |
| - /** |
116 |
| - * Tests Priority.INFO version2Level. |
117 |
| - */ |
118 |
| - @Test |
119 |
| - @SuppressWarnings("deprecation") |
120 |
| - public void testInfoVersion2Level() { |
121 |
| - assertEquals(org.apache.logging.log4j.Level.INFO, Priority.INFO.getVersion2Level()); |
122 |
| - } |
123 |
| - |
124 |
| - /** |
125 |
| - * Tests Priority.DEBUG version2Level. |
126 |
| - */ |
127 |
| - @Test |
128 |
| - @SuppressWarnings("deprecation") |
129 |
| - public void testDebugVersion2Level() { |
130 |
| - assertEquals(org.apache.logging.log4j.Level.DEBUG, Priority.DEBUG.getVersion2Level()); |
| 105 | + @ParameterizedTest |
| 106 | + @MethodSource() |
| 107 | + public void testVersion2Level(final Priority log4j1Priority, final org.apache.logging.log4j.Level log4j2Level) { |
| 108 | + assertEquals(log4j2Level, log4j1Priority.getVersion2Level()); |
131 | 109 | }
|
132 | 110 |
|
133 | 111 | /**
|
|
0 commit comments