public void test_isLenient(){
  DateFormat df=DateFormat.getInstance();
  Calendar c=df.getCalendar();
  if (df.isLenient()) {
    try {
      c.set(Calendar.DAY_OF_MONTH,32);
      c.get(Calendar.DAY_OF_MONTH);
    }
 catch (    Exception e) {
      fail("Unexpected exception " + e.toString());
    }
    c.setLenient(false);
    try {
      c.set(Calendar.DAY_OF_MONTH,32);
      c.get(Calendar.DAY_OF_MONTH);
      fail("Expected IllegalArgumentException was not thrown");
    }
 catch (    IllegalArgumentException e) {
    }
catch (    Exception e) {
      fail("Unexpected exception " + e.toString());
    }
  }
 else {
    try {
      c.set(Calendar.DAY_OF_MONTH,32);
      c.get(Calendar.DAY_OF_MONTH);
      fail("Expected IllegalArgumentException was not thrown");
    }
 catch (    IllegalArgumentException e) {
    }
catch (    Exception e) {
      fail("Unexpected exception " + e.toString());
    }
    c.setLenient(true);
    try {
      c.set(Calendar.DAY_OF_MONTH,32);
      c.get(Calendar.DAY_OF_MONTH);
    }
 catch (    Exception e) {
      fail("Unexpected exception " + e.toString());
    }
  }
}

public void test_isLenient ( ) { DateFormat df = DateFormat . getInstance ( ) ; Calendar c = df . getCalendar ( ) ; if ( df . isLenient ( ) ) { try { c . set ( Calendar . DAY_OF_MONTH , 32 ) ; c . get ( Calendar . DAY_OF_MONTH ) ; } catch ( Exception e ) { fail ( "Unexpected exception " + e . toString ( ) ) ; } c . setLenient ( false ) ; try { c . set ( Calendar . DAY_OF_MONTH , 32 ) ; c . get ( Calendar . DAY_OF_MONTH ) ; fail ( "Expected IllegalArgumentException was not thrown" ) ; } catch ( IllegalArgumentException e ) { } catch ( Exception e ) { fail ( "Unexpected exception " + e . toString ( ) ) ; } } else { try { c . set ( Calendar . DAY_OF_MONTH , 32 ) ; c . get ( Calendar . DAY_OF_MONTH ) ; fail ( "Expected IllegalArgumentException was not thrown" ) ; } catch ( IllegalArgumentException e ) { } catch ( Exception e ) { fail ( "Unexpected exception " + e . toString ( ) ) ; } c . setLenient ( true ) ; try { c . set ( Calendar . DAY_OF_MONTH , 32 ) ; c . get ( Calendar . DAY_OF_MONTH ) ; } catch ( Exception e ) { fail ( "Unexpected exception " + e . toString ( ) ) ; } } }
java . text . dateformat # islenient ( ) test of method java . text . dateformat # islenient ( ) .
