< prev index next >

test/jdk/java/text/Format/CompactNumberFormat/TestCompactPatternsValidity.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 20,30 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 8177552 * @summary Checks the validity of compact number patterns specified through * CompactNumberFormat constructor * @run testng/othervm TestCompactPatternsValidity */ --- 20,30 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test ! * @bug 8177552 8217254 * @summary Checks the validity of compact number patterns specified through * CompactNumberFormat constructor * @run testng/othervm TestCompactPatternsValidity */
*** 78,88 **** {new String[]{"", "", "", "0 'do", "00K"}}, {new String[]{"", "", "", "0K", "00 don't"}}, // A non empty pattern containing no 0s (min integer digits) {new String[]{"K", "0K", "00K"}}, // 0s (min integer digits) exceeding for the range at index 3 ! {new String[]{"", "", "0K", "00000K"}},}; } @DataProvider(name = "validPatternsFormat") Object[][] validPatternsFormat() { return new Object[][]{ --- 78,90 ---- {new String[]{"", "", "", "0 'do", "00K"}}, {new String[]{"", "", "", "0K", "00 don't"}}, // A non empty pattern containing no 0s (min integer digits) {new String[]{"K", "0K", "00K"}}, // 0s (min integer digits) exceeding for the range at index 3 ! {new String[]{"", "", "0K", "00000K"}}, ! // null as a compact pattern ! {new String[]{"", "", null, "00K"}},}; } @DataProvider(name = "validPatternsFormat") Object[][] validPatternsFormat() { return new Object[][]{
*** 122,132 **** List.of(21L, -21L, 100.90, -100.90, 1000L, -1000L, 30000L, -30000L, 12345678988000000L, -12345678988000000L)}, {COMPACT_PATTERN12, List.of("0", "H5H", "H-5H", "30K", "30K-", "H50G"), List.of(0L, 500L, -500L, 30000L, -30000L, 5000000L)},}; } @Test(dataProvider = "invalidPatterns", ! expectedExceptions = RuntimeException.class) public void testInvalidCompactPatterns(String[] compactPatterns) { new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols .getInstance(Locale.US), compactPatterns); } --- 124,134 ---- List.of(21L, -21L, 100.90, -100.90, 1000L, -1000L, 30000L, -30000L, 12345678988000000L, -12345678988000000L)}, {COMPACT_PATTERN12, List.of("0", "H5H", "H-5H", "30K", "30K-", "H50G"), List.of(0L, 500L, -500L, 30000L, -30000L, 5000000L)},}; } @Test(dataProvider = "invalidPatterns", ! expectedExceptions = IllegalArgumentException.class) public void testInvalidCompactPatterns(String[] compactPatterns) { new CompactNumberFormat("#,##0.0#", DecimalFormatSymbols .getInstance(Locale.US), compactPatterns); }
< prev index next >