Merge pull request #11067 from kohlschuetter/pr/11066

Fixes #11066 - URIUtilTest.testFileUriGetUriLastPathSegment on macOS
This commit is contained in:
Joakim Erdfelt 2023-12-15 06:35:07 -06:00 committed by GitHub
commit fa7ea8a13c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 4 deletions

View File

@ -810,12 +810,24 @@ public class URIUtilTest
FS.touch(base); FS.touch(base);
} }
URI uri = base.toUri(); URI uri = base.toUri();
if (OS.MAC.isCurrentOs())
try
{ {
// Normalize Unicode to NFD form that OSX Path/FileSystem produces assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
expectedName = Normalizer.normalize(expectedName, Normalizer.Form.NFD); }
catch (AssertionError e)
{
if (OS.MAC.isCurrentOs())
{
// Normalize Unicode to NFD form that OSX Path/FileSystem produces
expectedName = Normalizer.normalize(expectedName, Normalizer.Form.NFD);
assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
}
else
{
throw e;
}
} }
assertThat(URIUtil.getUriLastPathSegment(uri), is(expectedName));
} }
public static Stream<Arguments> uriLastSegmentSource() throws IOException public static Stream<Arguments> uriLastSegmentSource() throws IOException