public void testWithers() { DateTime test = new DateTime(1970, 6, 9, 10, 20, 30, 40, GJ_DEFAULT); check(test.withYear(2000), 2000, 6, 9, 10, 20, 30, 40); check(test.withMonthOfYear(2), 1970, 2, 9, 10, 20, 30, 40); check(test.withDayOfMonth(2), 1970, 6, 2, 10, 20, 30, 40); check(test.withDayOfYear(6), 1970, 1, 6, 10, 20, 30, 40); check(test.withDayOfWeek(6), 1970, 6, 13, 10, 20, 30, 40); check(test.withWeekOfWeekyear(6), 1970, 2, 3, 10, 20, 30, 40); check(test.withWeekyear(1971), 1971, 6, 15, 10, 20, 30, 40); check(test.withYearOfCentury(60), 1960, 6, 9, 10, 20, 30, 40); check(test.withCenturyOfEra(21), 2070, 6, 9, 10, 20, 30, 40); check(test.withYearOfEra(1066), 1066, 6, 9, 10, 20, 30, 40); check(test.withEra(DateTimeConstants.BC), -1970, 6, 9, 10, 20, 30, 40); check(test.withHourOfDay(6), 1970, 6, 9, 6, 20, 30, 40); check(test.withMinuteOfHour(6), 1970, 6, 9, 10, 6, 30, 40); check(test.withSecondOfMinute(6), 1970, 6, 9, 10, 20, 6, 40); check(test.withMillisOfSecond(6), 1970, 6, 9, 10, 20, 30, 6); check(test.withMillisOfDay(61234), 1970, 6, 9, 0, 1, 1, 234); try { test.withMonthOfYear(0); fail(); } catch (IllegalArgumentException ex) { } try { test.withMonthOfYear(13); fail(); } catch (IllegalArgumentException ex) { } }