Java Code Examples for java.util.Locale#getExtensionKeys()

The following examples show how to use java.util.Locale#getExtensionKeys() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 2
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 3
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 4
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 5
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 6
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 7
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 8
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 9
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 10
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 11
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 12
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}
 
Example 13
public void testGetExtensionKeys() {
    Locale locale = Locale.forLanguageTag("und-a-xx-yy-b-zz-ww");
    Set<Character> result = locale.getExtensionKeys();
    assertEquals("result size", 2, result.size());
    assertTrue("'a','b'", result.contains('a') && result.contains('b'));

    // result is not mutable
    try {
        result.add('x');
        errln("expected exception on add to extension key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }

    // returns empty set if no extensions
    locale = Locale.forLanguageTag("und");
    assertTrue("empty result", locale.getExtensionKeys().isEmpty());
}