@TestTargets({
   @TestTargetNew(
       level = TestLevel.COMPLETE,
       notes = "",
       method = "isLenient",
       args = {}),
   @TestTargetNew(
       level = TestLevel.COMPLETE,
       notes = "",
       method = "setLenient",
       args = {boolean.class})
 })
 public void test_isLenient() {
   Calendar cal = Calendar.getInstance();
   assertTrue(cal.isLenient());
   cal.set(Calendar.MONTH, 35);
   cal.get(Calendar.MONTH);
   cal.setLenient(false);
   cal.set(Calendar.MONTH, 35);
   try {
     cal.get(Calendar.MONTH);
     fail("IllegalArgumentException expected");
   } catch (IllegalArgumentException e) {
     // expected
   }
   assertFalse(cal.isLenient());
   cal.setLenient(true);
   cal.set(Calendar.MONTH, 35);
   cal.get(Calendar.MONTH);
   assertTrue(cal.isLenient());
 }
 /**
  * Accepts from the user.
  *
  * @throws IOException
  */
 static void input() throws IOException {
   Calendar c = Calendar.getInstance();
   System.out.println(c.isLenient());
   System.out.print("Enter First Date (dd/mm/yyyy): ");
   date1 = getDate(bufferedReader.readLine());
   //			date1 = getDate("06/18/2009");
   System.out.print("Enter Second Date (dd/mm/yyyy): ");
   date2 = getDate(bufferedReader.readLine());
   //			date2 = getDate("06/18/2010");
 }
예제 #3
0
 public void write(Kryo kryo, Output output, Calendar object) {
   timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null
   output.writeLong(object.getTimeInMillis(), true);
   output.writeBoolean(object.isLenient());
   output.writeInt(object.getFirstDayOfWeek(), true);
   output.writeInt(object.getMinimalDaysInFirstWeek(), true);
   if (object instanceof GregorianCalendar)
     output.writeLong(((GregorianCalendar) object).getGregorianChange().getTime(), false);
   else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false);
 }