From a1f347efc08eccd46910daf3e0b2c4062c6925b4 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 3 Jan 2025 13:55:35 +0000 Subject: [PATCH] Prefer JDK methods to Plexus (#80) --- .../remote/RemoteResourcesMojoTest.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java b/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java index b8333c4..7cbdcf1 100644 --- a/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java +++ b/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java @@ -184,11 +184,9 @@ public void testVelocityUTF8() throws Exception { file = new File(file, "UTF-8.bin"); assertTrue(file.exists()); - try (InputStream in = Files.newInputStream(file.toPath())) { - byte[] data = IOUtil.toByteArray(in); - byte[] expected = "\u00E4\u00F6\u00FC\u00C4\u00D6\u00DC\u00DF".getBytes(StandardCharsets.UTF_8); - assertTrue(Arrays.equals(expected, data)); - } + byte[] data = Files.readAllBytes(file.toPath()); + byte[] expected = "\u00E4\u00F6\u00FC\u00C4\u00D6\u00DC\u00DF".getBytes(StandardCharsets.UTF_8); + assertTrue(Arrays.equals(expected, data)); } public void testVelocityISO88591() throws Exception { @@ -210,11 +208,9 @@ public void testVelocityISO88591() throws Exception { file = new File(file, "ISO-8859-1.bin"); assertTrue(file.exists()); - try (InputStream in = Files.newInputStream(file.toPath())) { - byte[] data = IOUtil.toByteArray(in); - byte[] expected = "\u00E4\u00F6\u00FC\u00C4\u00D6\u00DC\u00DF".getBytes(StandardCharsets.ISO_8859_1); - assertTrue(Arrays.equals(expected, data)); - } + byte[] data = Files.readAllBytes(file.toPath()); + byte[] expected = "\u00E4\u00F6\u00FC\u00C4\u00D6\u00DC\u00DF".getBytes(StandardCharsets.ISO_8859_1); + assertTrue(Arrays.equals(expected, data)); } public void testFilteredBundles() throws Exception {