Package java.text

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()


  {
    SimpleDateFormat formatter = getFormatter(pattern, locale);
    if (pattern != null)
    {
      if (locPattern) {
        formatter.applyLocalizedPattern(pattern);
      }
      else {
        formatter.applyPattern(pattern);
      }
    }
View Full Code Here


     */
    public void test_applyLocalizedPatternLjava_lang_String() {
        // Test for method void
        // java.text.SimpleDateFormat.applyLocalizedPattern(java.lang.String)
        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
        f2.applyLocalizedPattern("GuMtkHmsSEDFwWahKz");
        String pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern
                .equals("GyMdkHmsSEDFwWahKz"));

        // test the new "Z" pattern char
View Full Code Here

        assertTrue("Wrong pattern: " + pattern, pattern
                .equals("GyMdkHmsSEDFwWahKz"));

        // test the new "Z" pattern char
        f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
        f2.applyLocalizedPattern("G u M t Z");
        pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));

        // test invalid patterns
        try {
View Full Code Here

        pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));

        // test invalid patterns
        try {
            f2.applyLocalizedPattern("b");
            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern("y");
            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: y");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: y");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern("a '");
            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern(null);
            fail("Expected NullPointerException for null pattern");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

  public void test(TestHarness harness)
  {
    SimpleDateFormat f = new SimpleDateFormat("yyyy", Locale.CHINA);
    try
      {
  f.applyLocalizedPattern("j-nnn-aaaa");
      }
    catch (IllegalArgumentException iae)
      {
  harness.debug(iae);
  harness.check(false);
View Full Code Here

    harness.check(f.toPattern(), "d-MMM-yyyy");
    // try invalid argument
    try
    {
      f.applyLocalizedPattern("XYZ");
      harness.check(false);
    }
    catch (IllegalArgumentException e)
    {
      harness.check(true);   
View Full Code Here

    }
    // try null argument
    try
    {
      f.applyLocalizedPattern(null);
      harness.check(false);
    }
    catch (NullPointerException e)
    {
      harness.check(true);  
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.