|
1 | 1 | /* |
2 | | - * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
42 | 42 | import java.util.Set; |
43 | 43 |
|
44 | 44 | import org.junit.jupiter.api.Test; |
| 45 | +import org.junit.jupiter.params.ParameterizedTest; |
| 46 | +import org.junit.jupiter.params.provider.EmptySource; |
| 47 | +import org.junit.jupiter.params.provider.NullSource; |
45 | 48 |
|
| 49 | +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; |
46 | 50 | import static org.junit.jupiter.api.Assertions.fail; |
47 | 51 |
|
48 | 52 | /** |
49 | 53 | * @test |
50 | 54 | * @bug 6875847 6992272 7002320 7015500 7023613 7032820 7033504 7004603 |
51 | | - * 7044019 8008577 8176853 8255086 8263202 8287868 8174269 |
| 55 | + * 7044019 8008577 8176853 8255086 8263202 8287868 8174269 8369452 |
52 | 56 | * @summary test API changes to Locale |
53 | 57 | * @modules jdk.localedata |
54 | 58 | * @compile LocaleEnhanceTest.java |
@@ -763,6 +767,20 @@ public void testBuilderSetLanguageTag() { |
763 | 767 | new BuilderILE() { public void call() { b.setLanguageTag("und-u-nu-thai-NU-chinese-xx-1234"); }}; |
764 | 768 | } |
765 | 769 |
|
| 770 | + // Test the values that should clear the builder |
| 771 | + @ParameterizedTest |
| 772 | + @NullSource |
| 773 | + @EmptySource |
| 774 | + public void testBuilderSetLanguageTagClear(String tag) { |
| 775 | + var empty = new Builder(); |
| 776 | + var bldr = new Builder(); |
| 777 | + bldr.setLanguageTag("en-US"); |
| 778 | + assertDoesNotThrow(() -> bldr.setLanguageTag(tag)); |
| 779 | + assertEquals("Setting a %s language tag did not clear the builder" |
| 780 | + .formatted(tag == null ? "null" : "empty"), |
| 781 | + empty.build(), bldr.build()); |
| 782 | + } |
| 783 | + |
766 | 784 | @Test |
767 | 785 | public void testBuilderSetLanguage() { |
768 | 786 | // language is normalized to lower case |
|
0 commit comments