Changeset 19637 in josm for trunk/test
- Timestamp:
- 2026-10-06T08:57:52+02:00 (8 days ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 edited
-
gui/bugreport/BugReportDialogTest.java (added)
-
tools/bugreport/ReportedExceptionTest.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/tools/bugreport/ReportedExceptionTest.java
r17275 r19637 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 5 7 8 import java.nio.file.InvalidPathException; 6 9 import java.util.Arrays; 7 10 … … 62 65 63 66 /** 67 * Tests {@link ReportedException#isUnmappableFileName()}: a file name which the character set used for file names 68 * cannot represent is recognised, also as the cause of another exception, but only if that character set is not 69 * UTF-8 - otherwise the locale is not to blame. See #14596. 70 */ 71 @Test 72 void testIsUnmappableFileName() { 73 // the exception sun.nio.fs.UnixPath throws for "Capture d'écran.png" when the locale is C or not installed 74 InvalidPathException unmappable = new InvalidPathException("/home/user/Capture d'\u00e9cran.png", 75 "Malformed input or input contains unmappable characters"); 76 String jnuEncoding = System.getProperty("sun.jnu.encoding"); 77 try { 78 System.setProperty("sun.jnu.encoding", "ANSI_X3.4-1968"); 79 assertTrue(new ReportedException(unmappable).isUnmappableFileName()); 80 assertTrue(new ReportedException(new IllegalStateException(unmappable)).isUnmappableFileName()); 81 assertFalse(new ReportedException(new InvalidPathException("a\0b", "Nul character not allowed")).isUnmappableFileName()); 82 assertFalse(new ReportedException(new IllegalStateException()).isUnmappableFileName()); 83 84 System.setProperty("sun.jnu.encoding", "UTF-8"); 85 assertFalse(new ReportedException(unmappable).isUnmappableFileName()); 86 } finally { 87 System.setProperty("sun.jnu.encoding", jnuEncoding); 88 } 89 } 90 91 /** 64 92 * Tests that {@link ReportedException#isSame(ReportedException)} works as expected. 65 93 */
Note:
See TracChangeset
for help on using the changeset viewer.
