|
20 | 20 |
|
21 | 21 | import org.apache.logging.log4j.test.junit.Mutable; |
22 | 22 | import org.apache.logging.log4j.util.Constants; |
| 23 | +import org.assertj.core.presentation.UnicodeRepresentation; |
23 | 24 | import org.junit.jupiter.api.Test; |
24 | 25 | import org.junit.jupiter.api.parallel.ResourceAccessMode; |
25 | 26 | import org.junit.jupiter.api.parallel.ResourceLock; |
26 | 27 | import org.junit.jupiter.api.parallel.Resources; |
27 | 28 |
|
28 | | -import static org.junit.jupiter.api.Assertions.*; |
| 29 | +import static org.assertj.core.api.Assertions.assertThat; |
| 30 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 31 | +import static org.junit.jupiter.api.Assertions.assertNotNull; |
29 | 32 |
|
30 | 33 | @ResourceLock(value = Resources.LOCALE, mode = ResourceAccessMode.READ) |
31 | 34 | public class MessageFormatMessageTest { |
32 | 35 |
|
33 | | - private static final String SPACE = Constants.JAVA_MAJOR_VERSION < 9 ? " " : "\u00a0"; |
| 36 | + private static final char SPACE = ' '; |
| 37 | + private static final char NB_SPACE = '\u00a0'; |
| 38 | + private static final char NARROW_NB_SPACE = '\u202f'; |
34 | 39 |
|
35 | 40 | private static final int LOOP_CNT = 500; |
36 | 41 | String[] array = new String[LOOP_CNT]; |
@@ -72,8 +77,10 @@ public void testOneIntArgLocaleFrance() { |
72 | 77 | final String testMsg = "Test message {0,number,currency}"; |
73 | 78 | final MessageFormatMessage msg = new MessageFormatMessage(Locale.FRANCE, testMsg, 1234567890); |
74 | 79 | final String result = msg.getFormattedMessage(); |
75 | | - final String expected = "Test message 1 234 567 890,00" + SPACE + "€"; |
76 | | - assertEquals(expected, result); |
| 80 | + final char separator = Constants.JAVA_MAJOR_VERSION < 9 ? SPACE : NB_SPACE; |
| 81 | + final char groupingSeparator = Constants.JAVA_MAJOR_VERSION < 17 ? NB_SPACE : NARROW_NB_SPACE; |
| 82 | + assertThat(result).withRepresentation(UnicodeRepresentation.UNICODE_REPRESENTATION) |
| 83 | + .isEqualTo("Test message 1%1$c234%1$c567%1$c890,00%2$c€", groupingSeparator, separator); |
77 | 84 | } |
78 | 85 |
|
79 | 86 | @Test |
|
0 commit comments