From e01261580caadfdb22ccd2e293ae99a1097d66f7 Mon Sep 17 00:00:00 2001 From: Naoto Sato Date: Thu, 16 Nov 2023 15:15:34 -0800 Subject: [PATCH] Minor fix to test --- .../jdk/java/nio/charset/Charset/AliasesCopy.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test/jdk/java/nio/charset/Charset/AliasesCopy.java b/test/jdk/java/nio/charset/Charset/AliasesCopy.java index 1e7607b61230e..66ee830c5f6ff 100644 --- a/test/jdk/java/nio/charset/Charset/AliasesCopy.java +++ b/test/jdk/java/nio/charset/Charset/AliasesCopy.java @@ -33,27 +33,22 @@ import java.util.Set; import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertIterableEquals; public class AliasesCopy { private static final Set ALIASES_SET = Set.of("foo-alias"); - private static final String[] MUTABLE_ALIASES = ALIASES_SET.toArray(String[]::new); + private static final String[] ALIASES_ARRAY = ALIASES_SET.toArray(String[]::new); @Test public void aliasesCopy() { - final FooCharset cs = new FooCharset(); - cs.changeAliasesAfterConstruction(); + final FooCharset cs = new FooCharset(ALIASES_ARRAY); + ALIASES_ARRAY[0] = "bar-alias"; assertIterableEquals(ALIASES_SET, cs.aliases()); } private static final class FooCharset extends Charset { - private FooCharset() { - super("foo", MUTABLE_ALIASES); - } - - private void changeAliasesAfterConstruction() { - MUTABLE_ALIASES[0] = "bar-alias"; + private FooCharset(String[] aliases) { + super("foo", aliases); } @Override