public void test_applyLocalizedPatternLjava_lang_String(){
  DecimalFormat format=new DecimalFormat();
  try {
    format.applyLocalizedPattern("#.#");
    assertEquals("Wrong pattern 1","#0.#",format.toLocalizedPattern());
    format.applyLocalizedPattern("#.");
    assertEquals("Wrong pattern 2","#0.",format.toLocalizedPattern());
    format.applyLocalizedPattern("#");
    assertEquals("Wrong pattern 3","#",format.toLocalizedPattern());
    format.applyLocalizedPattern(".#");
    assertEquals("Wrong pattern 4","#.0",format.toLocalizedPattern());
    try {
      format.applyLocalizedPattern("'#,#:#0.0#;(#)");
      fail("Expected IllegalArgumentException was not thrown");
    }
 catch (    IllegalArgumentException e) {
    }
    try {
      format.applyLocalizedPattern((String)null);
      fail("Expected NullPointerException was not thrown");
    }
 catch (    NullPointerException e) {
    }
  }
 catch (  Exception e) {
    fail("Unexpected exception " + e.toString());
  }
}

public void test_applyLocalizedPatternLjava_lang_String ( ) { DecimalFormat format = new DecimalFormat ( ) ; try { format . applyLocalizedPattern ( "#.#" ) ; assertEquals ( "Wrong pattern 1" , "#0.#" , format . toLocalizedPattern ( ) ) ; format . applyLocalizedPattern ( "#." ) ; assertEquals ( "Wrong pattern 2" , "#0." , format . toLocalizedPattern ( ) ) ; format . applyLocalizedPattern ( "#" ) ; assertEquals ( "Wrong pattern 3" , "#" , format . toLocalizedPattern ( ) ) ; format . applyLocalizedPattern ( ".#" ) ; assertEquals ( "Wrong pattern 4" , "#.0" , format . toLocalizedPattern ( ) ) ; try { format . applyLocalizedPattern ( "'#,#:#0.0#;(#)" ) ; fail ( "Expected IllegalArgumentException was not thrown" ) ; } catch ( IllegalArgumentException e ) { } try { format . applyLocalizedPattern ( ( String ) null ) ; fail ( "Expected NullPointerException was not thrown" ) ; } catch ( NullPointerException e ) { } } catch ( Exception e ) { fail ( "Unexpected exception " + e . toString ( ) ) ; } }
case 1 : try to apply correct variants of pattern . case 2 : try to apply malformed patten . case 3 : try to apply null pattern .
