Locale { @Pure public static String getString(Class<?> resource, String key, Object... params) { return getString(ClassLoaderFinder.findClassLoader(), detectResourceClass(resource), key, params); } private  Locale(); static Charset[] getPriorizedDecodingCharsets(); static void setPriorizedDecodingCharsets(Charset[] charsets); @Pure @Inline(value = "Locale.getStringWithDefaultFrom(ClassLoaderFinder.findClassLoader(), ($1), ($2), ($3), ($4))", imported = {Locale.class, ClassLoaderFinder.class}) static String getStringWithDefaultFrom(String resourcePath, String key, String defaultValue, Object... params); @Pure static String getStringWithDefaultFrom(ClassLoader classLoader, String resourcePath, String key,
			String defaultValue, Object... params); @Pure @Inline(value = "Locale.getStringWithDefaultFrom(($1), ($2), ($3), ($4))", imported = {Locale.class}) static String getStringFrom(String resourcePath, String key, Object... params); @Pure @Inline(value = "Locale.getStringWithDefaultFrom(($1), ($2), ($3), ($3), ($4))", imported = {Locale.class}) static String getStringFrom(ClassLoader classLoader, String resourcePath, String key, Object... params); @Pure static String getString(Class<?> resource, String key, Object... params); @Pure static String getString(ClassLoader classLoader, Class<?> resource, String key, Object... params); static String getString(String key, Object... params); @Pure static String getString(ClassLoader classLoader, String key, Object... params); @Pure static String getStringWithDefault(Class<?> resource, String key, String defaultValue, Object... params); @Pure static String getStringWithDefault(ClassLoader classLoader, Class<?> resource, String key,
			String defaultValue, Object... params); @Pure static String getStringWithDefault(String key, String defaultValue, Object... params); @Pure static String getStringWithDefault(ClassLoader classLoader, String key, String defaultValue, Object... params); @Pure static String decodeString(byte[] bytes); static String decodeString(InputStream stream); static boolean decodeString(InputStream stream, List<String> lineArray);  }
@Test public void getStringClassStringStringArray() { assertEquals(NOKEY, Locale.getString(LocaleTest.class,NOKEY,P1,P2,P3)); assertEquals( "ABC P1 'P2' {2}", Locale.getString(LocaleTest.class,KEY1,P1,P2,P3)); assertEquals( "ABC P3 'P1' {2}", Locale.getString(LocaleTest.class,KEY1,P3,P1,P2)); assertEquals( NOKEY, Locale.getString(LocaleStub.class,NOKEY,P1,P2,P3)); assertEquals( "DEF P1 'P2' {2}", Locale.getString(LocaleStub.class,KEY1,P1,P2,P3)); assertEquals( "DEF P3 'P1' {2}", Locale.getString(LocaleStub.class,KEY1,P3,P1,P2)); }
@Test public void getStringClassLoaderClassStringStringArray() { ClassLoader l = LocaleTest.class.getClassLoader(); assertEquals(NOKEY, Locale.getString(l, LocaleTest.class,NOKEY,P1,P2,P3)); assertEquals( "ABC P1 'P2' {2}", Locale.getString(l, LocaleTest.class,KEY1,P1,P2,P3)); assertEquals( "ABC P3 'P1' {2}", Locale.getString(l, LocaleTest.class,KEY1,P3,P1,P2)); assertEquals( NOKEY, Locale.getString(l, LocaleStub.class,NOKEY,P1,P2,P3)); assertEquals( "DEF P1 'P2' {2}", Locale.getString(l, LocaleStub.class,KEY1,P1,P2,P3)); assertEquals( "DEF P3 'P1' {2}", Locale.getString(l, LocaleStub.class,KEY1,P3,P1,P2)); }
@Test public void getStringStringStringArray() { assertEquals( NOKEY, Locale.getString(NOKEY,P1,P2,P3)); assertEquals( "ABC P1 'P2' {2}", Locale.getString(KEY1,P1,P2,P3)); assertEquals( "ABC P3 'P1' {2}", Locale.getString(KEY1,P3,P1,P2)); try { Locale.getString(KEY2); fail("expecting IllegalArgumentException"); } catch(IllegalArgumentException exception) { } assertEquals( "(d92b87b0-efe9-4dd9-903f-7c994b8e2a9f)", Locale.getString(KEY3)); }
@Test public void getStringClassLoaderStringStringArray() { ClassLoader l = LocaleTest.class.getClassLoader(); assertEquals( NOKEY, Locale.getString(l, NOKEY,P1,P2,P3)); assertEquals( "ABC P1 'P2' {2}", Locale.getString(l, KEY1,P1,P2,P3)); assertEquals( "ABC P3 'P1' {2}", Locale.getString(l, KEY1,P3,P1,P2)); try { Locale.getString(l, KEY2); fail("expecting IllegalArgumentException"); } catch(IllegalArgumentException exception) { } assertEquals( "(d92b87b0-efe9-4dd9-903f-7c994b8e2a9f)", Locale.getString(l, KEY3)); }
@Test public void getStringWithRawFormatStyle() { Number data; String raw, localized; data = Double.valueOf(123.456); raw = Double.toString(123.456); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); data = Double.valueOf(-123.456); raw = Double.toString(-123.456); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); data = Long.valueOf(123456); raw = Long.toString(123456); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); data = Long.valueOf(-123456); raw = Long.toString(-123456); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); data = Short.valueOf((short)123); raw = Short.toString((short)123); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); data = Short.valueOf((short)-123); raw = Short.toString((short)-123); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); raw = "123456789123456789123456789.123456789"; data = new BigDecimal(raw); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); raw = "-123456789123456789123456789.123456789"; data = new BigDecimal(raw); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); raw = "123456789123456789123456789123456789"; data = new BigInteger(raw); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); raw = "-123456789123456789123456789123456789"; data = new BigInteger(raw); localized = MessageFormat.format("{0}", data); assertEquals( localized+" "+raw, Locale.getString("FOUR", data)); }
@Test public void getStringWithRawFormatStyleWithFormat1() { Number data; data = Double.valueOf(123.456); assertEquals( "123", Locale.getString("FORMAT_1", data)); data = Double.valueOf(-123.456); assertEquals( "-123", Locale.getString("FORMAT_1", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_1", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_1", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_1", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_1", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789", Locale.getString("FORMAT_1", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456790", Locale.getString("FORMAT_1", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789", Locale.getString("FORMAT_1", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456790", Locale.getString("FORMAT_1", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_1", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_1", data)); }
@Test public void getStringWithRawFormatStyleWithFormat2() { Number data; data = Double.valueOf(123.456); assertEquals( "123", Locale.getString("FORMAT_2", data)); data = Double.valueOf(-123.456); assertEquals( "-123", Locale.getString("FORMAT_2", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_2", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_2", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_2", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_2", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789", Locale.getString("FORMAT_2", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456790", Locale.getString("FORMAT_2", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789", Locale.getString("FORMAT_2", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456790", Locale.getString("FORMAT_2", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_2", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_2", data)); }
@Test public void getStringWithRawFormatStyleWithFormat3() { Number data; data = Double.valueOf(123.456); assertEquals( "123.5", Locale.getString("FORMAT_3", data)); data = Double.valueOf(-123.456); assertEquals( "-123.5", Locale.getString("FORMAT_3", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_3", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_3", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_3", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_3", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789.1", Locale.getString("FORMAT_3", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456790.0", Locale.getString("FORMAT_3", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789.1", Locale.getString("FORMAT_3", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456790.0", Locale.getString("FORMAT_3", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_3", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_3", data)); }
@Test public void getStringWithRawFormatStyleWithFormat4() { Number data; data = Double.valueOf(123.456); assertEquals( "123.46", Locale.getString("FORMAT_4", data)); data = Double.valueOf(-123.456); assertEquals( "-123.46", Locale.getString("FORMAT_4", data)); data = Long.valueOf(123456); assertEquals( "123456.0", Locale.getString("FORMAT_4", data)); data = Long.valueOf(-123456); assertEquals( "-123456.0", Locale.getString("FORMAT_4", data)); data = Short.valueOf((short)123); assertEquals( "123.0", Locale.getString("FORMAT_4", data)); data = Short.valueOf((short)-123); assertEquals( "-123.0", Locale.getString("FORMAT_4", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789.12", Locale.getString("FORMAT_4", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456789.99", Locale.getString("FORMAT_4", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789.12", Locale.getString("FORMAT_4", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456789.99", Locale.getString("FORMAT_4", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789.0", Locale.getString("FORMAT_4", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789.0", Locale.getString("FORMAT_4", data)); }
@Test public void getStringWithRawFormatStyleWithFormat5() { Number data; data = Double.valueOf(123.456); assertEquals( "123.456", Locale.getString("FORMAT_5", data)); data = Double.valueOf(-123.456); assertEquals( "-123.456", Locale.getString("FORMAT_5", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_5", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_5", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_5", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_5", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789.123", Locale.getString("FORMAT_5", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456789.988", Locale.getString("FORMAT_5", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789.123", Locale.getString("FORMAT_5", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456789.988", Locale.getString("FORMAT_5", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_5", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_5", data)); }
@Test public void getStringWithRawFormatStyleWithFormat6() { Number data; data = Double.valueOf(123.456); assertEquals( "123", Locale.getString("FORMAT_6", data)); data = Double.valueOf(-123.456); assertEquals( "-123", Locale.getString("FORMAT_6", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_6", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_6", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_6", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_6", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789", Locale.getString("FORMAT_6", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456790", Locale.getString("FORMAT_6", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789", Locale.getString("FORMAT_6", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456790", Locale.getString("FORMAT_6", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_6", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_6", data)); }
@Test public void getStringWithRawFormatStyleWithFormat7() { Number data; data = Double.valueOf(123.456); assertEquals( "123", Locale.getString("FORMAT_7", data)); data = Double.valueOf(-123.456); assertEquals( "-123", Locale.getString("FORMAT_7", data)); data = Long.valueOf(123456); assertEquals( "123456", Locale.getString("FORMAT_7", data)); data = Long.valueOf(-123456); assertEquals( "-123456", Locale.getString("FORMAT_7", data)); data = Short.valueOf((short)123); assertEquals( "123", Locale.getString("FORMAT_7", data)); data = Short.valueOf((short)-123); assertEquals( "-123", Locale.getString("FORMAT_7", data)); data = new BigDecimal("123456789123456789123456789.123456789"); assertEquals( "123456789123456789123456789", Locale.getString("FORMAT_7", data)); data = new BigDecimal("123456789123456789123456789.987654321"); assertEquals( "123456789123456789123456790", Locale.getString("FORMAT_7", data)); data = new BigDecimal("-123456789123456789123456789.123456789"); assertEquals( "-123456789123456789123456789", Locale.getString("FORMAT_7", data)); data = new BigDecimal("-123456789123456789123456789.987654321"); assertEquals( "-123456789123456789123456790", Locale.getString("FORMAT_7", data)); data = new BigInteger("123456789123456789123456789123456789"); assertEquals( "123456789123456789123456789123456789", Locale.getString("FORMAT_7", data)); data = new BigInteger("-123456789123456789123456789123456789"); assertEquals( "-123456789123456789123456789123456789", Locale.getString("FORMAT_7", data)); }