Java 类java.time.Year 实例源码

项目:CalendarFX    文件:YearMonthViewSkin.java   
private void updateHyerlinkSupport() {
    final YearMonthView view = getSkinnable();

    if (view.isEnableHyperlinks()) {
        monthLabel.setOnMouseClicked(evt -> {
            if (evt.getClickCount() == 1) {
                view.fireEvent(new RequestEvent(view, view, getSkinnable().getYearMonth()));
            }
        });

        yearLabel.setOnMouseClicked(evt -> {
            if (evt.getClickCount() == 1) {
                view.fireEvent(new RequestEvent(view, view, Year.of(getSkinnable().getYearMonth().getYear())));
            }
        });
    } else {
        monthLabel.setOnMouseClicked(null);
        yearLabel.setOnMouseClicked(null);
    }
}
项目:uroborosql    文件:DateTimeApiPropertyMapper.java   
@Override
public boolean canAccept(final Class<?> type) {
    return LocalDateTime.class.equals(type)
            || OffsetDateTime.class.equals(type)
            || ZonedDateTime.class.equals(type)
            || LocalDate.class.equals(type)
            || LocalTime.class.equals(type)
            || OffsetTime.class.equals(type)
            || Year.class.equals(type)
            || YearMonth.class.equals(type)
            || MonthDay.class.equals(type)
            || Month.class.equals(type)
            || DayOfWeek.class.equals(type)
            || checkEra(type)
            || checkChronoLocalDate(type);
}
项目:openjdk-jdk10    文件:TCKYear.java   
@Test
public void test_with() {
    Year base = Year.of(5);
    Year result = base.with(ChronoField.ERA, 0);
    assertEquals(result, base.with(IsoEra.of(0)));

    int prolepticYear = IsoChronology.INSTANCE.prolepticYear(IsoEra.of(0), 5);
    assertEquals(result.get(ChronoField.ERA), 0);
    assertEquals(result.get(ChronoField.YEAR), prolepticYear);
    assertEquals(result.get(ChronoField.YEAR_OF_ERA), 5);

    result = base.with(ChronoField.YEAR, 10);
    assertEquals(result.get(ChronoField.ERA), base.get(ChronoField.ERA));
    assertEquals(result.get(ChronoField.YEAR), 10);
    assertEquals(result.get(ChronoField.YEAR_OF_ERA), 10);

    result = base.with(ChronoField.YEAR_OF_ERA, 20);
    assertEquals(result.get(ChronoField.ERA), base.get(ChronoField.ERA));
    assertEquals(result.get(ChronoField.YEAR), 20);
    assertEquals(result.get(ChronoField.YEAR_OF_ERA), 20);
}
项目:openjdk-jdk10    文件:CopticDate.java   
@Override
public ValueRange range(TemporalField field) {
    if (field instanceof ChronoField) {
        if (isSupported(field)) {
            ChronoField f = (ChronoField) field;
            switch (f) {
                case DAY_OF_MONTH: return ValueRange.of(1, lengthOfMonth());
                case DAY_OF_YEAR: return ValueRange.of(1, lengthOfYear());
                case ALIGNED_WEEK_OF_MONTH: return ValueRange.of(1, month == 13 ? 1 : 5);
                case YEAR:
                case YEAR_OF_ERA: return (prolepticYear <= 0 ?
                        ValueRange.of(1, Year.MAX_VALUE + 1) : ValueRange.of(1, Year.MAX_VALUE));  // TODO
            }
            return getChronology().range(f);
        }
        throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
    }
    return field.rangeRefinedBy(this);
}
项目:jdk8u-jdk    文件:TCKLocalDate.java   
@Test
public void factory_ofEpochDay() {
    long date_0000_01_01 = -678941 - 40587;
    assertEquals(LocalDate.ofEpochDay(0), LocalDate.of(1970, 1, 1));
    assertEquals(LocalDate.ofEpochDay(date_0000_01_01), LocalDate.of(0, 1, 1));
    assertEquals(LocalDate.ofEpochDay(date_0000_01_01 - 1), LocalDate.of(-1, 12, 31));
    assertEquals(LocalDate.ofEpochDay(MAX_VALID_EPOCHDAYS), LocalDate.of(Year.MAX_VALUE, 12, 31));
    assertEquals(LocalDate.ofEpochDay(MIN_VALID_EPOCHDAYS), LocalDate.of(Year.MIN_VALUE, 1, 1));

    LocalDate test = LocalDate.of(0, 1, 1);
    for (long i = date_0000_01_01; i < 700000; i++) {
        assertEquals(LocalDate.ofEpochDay(i), test);
        test = next(test);
    }
    test = LocalDate.of(0, 1, 1);
    for (long i = date_0000_01_01; i > -2000000; i--) {
        assertEquals(LocalDate.ofEpochDay(i), test);
        test = previous(test);
    }
}
项目:openjdk-jdk10    文件:TCKZonedDateTime.java   
@Test
public void factory_ofInstant_minWithMaxOffset() {
    long days_0000_to_1970 = (146097 * 5) - (30 * 365 + 7);
    int year = Year.MIN_VALUE;
    long days = (year * 365L + (year / 4 - year / 100 + year / 400)) - days_0000_to_1970;
    Instant instant = Instant.ofEpochSecond(days * 24L * 60L * 60L - OFFSET_MAX.getTotalSeconds());
    ZonedDateTime test = ZonedDateTime.ofInstant(instant, OFFSET_MAX);
    assertEquals(test.getYear(), Year.MIN_VALUE);
    assertEquals(test.getMonth().getValue(), 1);
    assertEquals(test.getDayOfMonth(), 1);
    assertEquals(test.getOffset(), OFFSET_MAX);
    assertEquals(test.getHour(), 0);
    assertEquals(test.getMinute(), 0);
    assertEquals(test.getSecond(), 0);
    assertEquals(test.getNano(), 0);
}
项目:bson-codecs-jsr310    文件:YearCodec.java   
@Override
public void encode(
        BsonWriter writer,
        Year value,
        EncoderContext encoderContext) {

    writer.writeInt32(value.getValue());
}
项目:nitmproxy    文件:CertUtil.java   
public static Certificate newCert(String parentCertFile, String keyFile, String host) {
    try {
        Date before = Date.from(Instant.now());
        Date after = Date.from(Year.now().plus(3, ChronoUnit.YEARS).atDay(1).atStartOfDay(ZoneId.systemDefault()).toInstant());

        X509CertificateHolder parent = readPemFromFile(parentCertFile);
        PEMKeyPair pemKeyPair = readPemFromFile(keyFile);
        KeyPair keyPair = new JcaPEMKeyConverter()
                .setProvider(PROVIDER)
                .getKeyPair(pemKeyPair);

        X509v3CertificateBuilder x509 = new JcaX509v3CertificateBuilder(
                parent.getSubject(),
                new BigInteger(64, new SecureRandom()),
                before,
                after,
                new X500Name("CN=" + host),
                keyPair.getPublic());

        ContentSigner signer = new JcaContentSignerBuilder("SHA256WithRSAEncryption")
                .build(keyPair.getPrivate());

        JcaX509CertificateConverter x509CertificateConverter = new JcaX509CertificateConverter()
                .setProvider(PROVIDER);

        return new Certificate(
                keyPair,
                x509CertificateConverter.getCertificate(x509.build(signer)),
                x509CertificateConverter.getCertificate(parent));
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
项目:openjdk-jdk10    文件:TCKZonedDateTime.java   
@Test
public void test_with_adjuster_Year() {
    LocalDateTime ldt = LocalDateTime.of(2008, 6, 30, 23, 30, 59, 0);
    ZonedDateTime base = ZonedDateTime.of(ldt, ZONE_0100);
    ZonedDateTime test = base.with(Year.of(2007));
    assertEquals(test, ZonedDateTime.of(ldt.withYear(2007), ZONE_0100));
}
项目:maven-release-yearly-policy    文件:YearlyVersionPolicyTest.java   
@Test
public void shouldUseFirstVersionOfYearWhenVersionNotInYearlyFormat() throws Exception {
    testee = new YearlyVersionPolicy(Year.of(2017));

    result = testee.getDevelopmentVersion(version("1.2.3"));

    assertThat(result.getVersion(), is("2017.1-SNAPSHOT"));
}
项目:jdk8u-jdk    文件:TCKMinguoChronology.java   
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
    assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
    assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());

    MinguoDate minguo = MinguoDate.now();
    minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
    if (isLeapYear) {
        assertEquals(minguo.lengthOfMonth(), 29);
    } else {
        assertEquals(minguo.lengthOfMonth(), 28);
    }
}
项目:OpenJSharp    文件:ZoneRules.java   
/**
 * Gets the next transition after the specified instant.
 * <p>
 * This returns details of the next transition after the specified instant.
 * For example, if the instant represents a point where "Summer" daylight savings time
 * applies, then the method will return the transition to the next "Winter" time.
 *
 * @param instant  the instant to get the next transition after, not null, but null
 *  may be ignored if the rules have a single offset for all instants
 * @return the next transition after the specified instant, null if this is after the last transition
 */
public ZoneOffsetTransition nextTransition(Instant instant) {
    if (savingsInstantTransitions.length == 0) {
        return null;
    }
    long epochSec = instant.getEpochSecond();
    // check if using last rules
    if (epochSec >= savingsInstantTransitions[savingsInstantTransitions.length - 1]) {
        if (lastRules.length == 0) {
            return null;
        }
        // search year the instant is in
        int year = findYear(epochSec, wallOffsets[wallOffsets.length - 1]);
        ZoneOffsetTransition[] transArray = findTransitionArray(year);
        for (ZoneOffsetTransition trans : transArray) {
            if (epochSec < trans.toEpochSecond()) {
                return trans;
            }
        }
        // use first from following year
        if (year < Year.MAX_VALUE) {
            transArray = findTransitionArray(year + 1);
            return transArray[0];
        }
        return null;
    }

    // using historic rules
    int index  = Arrays.binarySearch(savingsInstantTransitions, epochSec);
    if (index < 0) {
        index = -index - 1;  // switched value is the next transition
    } else {
        index += 1;  // exact match, so need to add one to get the next
    }
    return new ZoneOffsetTransition(savingsInstantTransitions[index], wallOffsets[index], wallOffsets[index + 1]);
}
项目:openjdk-jdk10    文件:TCKYear.java   
@Test(dataProvider="minus_long_TemporalUnit")
public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class<?> expectedEx) {
    if (expectedEx == null) {
        assertEquals(base.minus(amount, unit), expectedYear);
    } else {
        try {
            Year result = base.minus(amount, unit);
            fail();
        } catch (Exception ex) {
            assertTrue(expectedEx.isInstance(ex));
        }
    }
}
项目:openjdk-jdk10    文件:TCKYear.java   
@Test
public void test_factory_int_singleton() {
    for (int i = -4; i <= 2104; i++) {
        Year test = Year.of(i);
        assertEquals(test.getValue(), i);
        assertEquals(Year.of(i), test);
    }
}
项目:openjdk-jdk10    文件:TCKMinguoChronology.java   
@Test(dataProvider="prolepticYear")
public void test_isLeapYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
    assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
    assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());

    MinguoDate minguo = MinguoDate.now();
    minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
    if (isLeapYear) {
        assertEquals(minguo.lengthOfMonth(), 29);
    } else {
        assertEquals(minguo.lengthOfMonth(), 28);
    }
}
项目:openjdk-jdk10    文件:TestDateTimeFormatter.java   
@Test
public void test_parse_errorMessage() throws Exception {
    assertGoodErrorDate(DayOfWeek::from, "DayOfWeek");
    assertGoodErrorDate(Month::from, "Month");
    assertGoodErrorDate(YearMonth::from, "YearMonth");
    assertGoodErrorDate(MonthDay::from, "MonthDay");
    assertGoodErrorDate(LocalDate::from, "LocalDate");
    assertGoodErrorDate(LocalTime::from, "LocalTime");
    assertGoodErrorDate(LocalDateTime::from, "LocalDateTime");
    assertGoodErrorDate(OffsetTime::from, "OffsetTime");
    assertGoodErrorDate(OffsetDateTime::from, "OffsetDateTime");
    assertGoodErrorDate(ZonedDateTime::from, "ZonedDateTime");
    assertGoodErrorDate(Instant::from, "Instant");
    assertGoodErrorDate(ZoneOffset::from, "ZoneOffset");
    assertGoodErrorDate(ZoneId::from, "ZoneId");
    assertGoodErrorDate(ThaiBuddhistChronology.INSTANCE::date, "");

    assertGoodErrorTime(DayOfWeek::from, "DayOfWeek");
    assertGoodErrorTime(Month::from, "Month");
    assertGoodErrorTime(Year::from, "Year");
    assertGoodErrorTime(YearMonth::from, "YearMonth");
    assertGoodErrorTime(MonthDay::from, "MonthDay");
    assertGoodErrorTime(LocalDate::from, "LocalDate");
    assertGoodErrorTime(LocalTime::from, "LocalTime");
    assertGoodErrorTime(LocalDateTime::from, "LocalDateTime");
    assertGoodErrorTime(OffsetTime::from, "OffsetTime");
    assertGoodErrorTime(OffsetDateTime::from, "OffsetDateTime");
    assertGoodErrorTime(ZonedDateTime::from, "ZonedDateTime");
    assertGoodErrorTime(Instant::from, "Instant");
    assertGoodErrorTime(ZoneOffset::from, "ZoneOffset");
    assertGoodErrorTime(ZoneId::from, "ZoneId");
    assertGoodErrorTime(ThaiBuddhistChronology.INSTANCE::date, "");
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test
public void now_Clock() {
    Instant instant = OffsetDateTime.of(LocalDate.of(2010, 12, 31), LocalTime.of(0, 0), ZoneOffset.UTC).toInstant();
    Clock clock = Clock.fixed(instant, ZoneOffset.UTC);
    Year test = Year.now(clock);
    assertEquals(test.getValue(), 2010);
}
项目:openjdk-jdk10    文件:TCKYear.java   
@Test
public void test_atDay_notLeapYear() {
    Year test = Year.of(2007);
    LocalDate expected = LocalDate.of(2007, 1, 1);
    for (int i = 1; i <= 365; i++) {
        assertEquals(test.atDay(i), expected);
        expected = expected.plusDays(1);
    }
}
项目:openjdk-jdk10    文件:TCKYear.java   
@Test(dataProvider="badParseData", expectedExceptions=DateTimeParseException.class)
public void factory_parse_fail(String text, int pos) {
    try {
        Year.parse(text);
        fail(String.format("Parse should have failed for %s at position %d", text, pos));
    } catch (DateTimeParseException ex) {
        assertEquals(ex.getParsedString(), text);
        assertEquals(ex.getErrorIndex(), pos);
        throw ex;
    }
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test(dataProvider="badParseData", expectedExceptions=DateTimeParseException.class)
public void factory_parse_fail(String text, int pos) {
    try {
        Year.parse(text);
        fail(String.format("Parse should have failed for %s at position %d", text, pos));
    } catch (DateTimeParseException ex) {
        assertEquals(ex.getParsedString(), text);
        assertEquals(ex.getErrorIndex(), pos);
        throw ex;
    }
}
项目:maven-release-yearly-policy    文件:YearlyVersionPolicyTest.java   
@Test
public void shouldGoToNextMinorVersionWhenExtraSubVersionsPresent() throws Exception {
    testee = new YearlyVersionPolicy(Year.of(2017));

    result = testee.getDevelopmentVersion(version("2017.3.2.1"));

    assertThat(result.getVersion(), is("2017.3.2.2-SNAPSHOT"));
}
项目:openjdk-jdk10    文件:TCKYear.java   
@DataProvider(name="isValidMonthDay")
Object[][] data_isValidMonthDay() {
    return new Object[][] {
            {Year.of(2007), MonthDay.of(6, 30), true},
            {Year.of(2008), MonthDay.of(2, 28), true},
            {Year.of(2008), MonthDay.of(2, 29), true},
            {Year.of(2009), MonthDay.of(2, 28), true},
            {Year.of(2009), MonthDay.of(2, 29), false},
            {Year.of(2009), null, false},
    };
}
项目:openjdk-jdk10    文件:TestOffsetDateTime_instants.java   
public void factory_ofInstant_maxWithMaxOffset() {
    long days_0000_to_1970 = (146097 * 5) - (30 * 365 + 7);
    int year = Year.MAX_VALUE;
    long days = (year * 365L + (year / 4 - year / 100 + year / 400)) + 365 - days_0000_to_1970;
    Instant instant = Instant.ofEpochSecond((days + 1) * 24L * 60L * 60L - 1 - OFFSET_MAX.getTotalSeconds());
    OffsetDateTime test = OffsetDateTime.ofInstant(instant, OFFSET_MAX);
    assertEquals(test.getYear(), Year.MAX_VALUE);
    assertEquals(test.getMonth().getValue(), 12);
    assertEquals(test.getDayOfMonth(), 31);
    assertEquals(test.getOffset(), OFFSET_MAX);
    assertEquals(test.getHour(), 23);
    assertEquals(test.getMinute(), 59);
    assertEquals(test.getSecond(), 59);
    assertEquals(test.getNano(), 0);
}
项目:git-rekt    文件:BookingsReportScreenController.java   
/**
 * This method is a little weird, but necessary, due to the quirks of JavaFX charts.
 *
 * Essentially, the problem boils down to the fact that JavaFX charts cannot cleanly handle
 * an integer based axis in exactly the way we need them to, so we have to hack around it by
 * using categories whose names just happen to be the integer days of the month.
 */
private void prepareXAxis() {
    int selectedYear = selectedMonth.getYear();
    int numDaysInMonth = selectedMonth.getMonth().length(Year.isLeap(selectedYear));
    for(int i = 1; i <= numDaysInMonth; i++) {
        daysInCurrentMonth.add(String.valueOf(i));
    }
    CategoryAxis xAxis  = (CategoryAxis) lineChart.getXAxis();
    xAxis.setCategories(daysInCurrentMonth);
}
项目:openjdk-jdk10    文件:TzdbZoneRulesProvider.java   
int parseYear(String year, int defaultYear) {
    switch (year.toLowerCase()) {
    case "min":  return 1900;
    case "max":  return Year.MAX_VALUE;
    case "only": return defaultYear;
    }
    return Integer.parseInt(year);
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test(dataProvider="plus_long_TemporalUnit")
public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class<?> expectedEx) {
    if (expectedEx == null) {
        assertEquals(base.plus(amount, unit), expectedYear);
    } else {
        try {
            base.plus(amount, unit);
            fail();
        } catch (Exception ex) {
            assertTrue(expectedEx.isInstance(ex));
        }
    }
}
项目:jdk8u-jdk    文件:TestDateTimeFormatter.java   
@Test
public void test_parse_errorMessage() throws Exception {
    assertGoodErrorDate(DayOfWeek::from, "DayOfWeek");
    assertGoodErrorDate(Month::from, "Month");
    assertGoodErrorDate(YearMonth::from, "YearMonth");
    assertGoodErrorDate(MonthDay::from, "MonthDay");
    assertGoodErrorDate(LocalDate::from, "LocalDate");
    assertGoodErrorDate(LocalTime::from, "LocalTime");
    assertGoodErrorDate(LocalDateTime::from, "LocalDateTime");
    assertGoodErrorDate(OffsetTime::from, "OffsetTime");
    assertGoodErrorDate(OffsetDateTime::from, "OffsetDateTime");
    assertGoodErrorDate(ZonedDateTime::from, "ZonedDateTime");
    assertGoodErrorDate(Instant::from, "Instant");
    assertGoodErrorDate(ZoneOffset::from, "ZoneOffset");
    assertGoodErrorDate(ZoneId::from, "ZoneId");
    assertGoodErrorDate(ThaiBuddhistChronology.INSTANCE::date, "");

    assertGoodErrorTime(DayOfWeek::from, "DayOfWeek");
    assertGoodErrorTime(Month::from, "Month");
    assertGoodErrorTime(Year::from, "Year");
    assertGoodErrorTime(YearMonth::from, "YearMonth");
    assertGoodErrorTime(MonthDay::from, "MonthDay");
    assertGoodErrorTime(LocalDate::from, "LocalDate");
    assertGoodErrorTime(LocalTime::from, "LocalTime");
    assertGoodErrorTime(LocalDateTime::from, "LocalDateTime");
    assertGoodErrorTime(OffsetTime::from, "OffsetTime");
    assertGoodErrorTime(OffsetDateTime::from, "OffsetDateTime");
    assertGoodErrorTime(ZonedDateTime::from, "ZonedDateTime");
    assertGoodErrorTime(Instant::from, "Instant");
    assertGoodErrorTime(ZoneOffset::from, "ZoneOffset");
    assertGoodErrorTime(ZoneId::from, "ZoneId");
    assertGoodErrorTime(ThaiBuddhistChronology.INSTANCE::date, "");
}
项目:maven-release-yearly-policy    文件:YearlyVersionPolicyTest.java   
@Test
public void shouldDefaultToFirstReleaseOfYearOnNonsenseVersion() throws Exception {
    testee = new YearlyVersionPolicy(Year.of(2017));

    result = testee.getDevelopmentVersion(version("This doesn't look like a version"));

    assertThat(result.getVersion(), is("2017.1-SNAPSHOT"));
}
项目:openjdk-jdk10    文件:TCKLocalDateTime.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_withYear_int_invalid() {
    TEST_2007_07_15_12_30_40_987654321.withYear(Year.MIN_VALUE - 1);
}
项目:openjdk-jdk10    文件:TCKYearMonth.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_withYear_tooHigh() {
    YearMonth test = YearMonth.of(2008, 6);
    test.withYear(Year.MAX_VALUE + 1);
}
项目:jdk8u-jdk    文件:TCKLocalDate.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_minusMonths_long_invalidTooLargeMaxAddMin() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 12, 1);
    test.minusMonths(Long.MIN_VALUE);
}
项目:openjdk-jdk10    文件:TCKYearMonth.java   
@Test(expectedExceptions={DateTimeException.class})
public void test_minusMonths_long_invalidTooLarge() {
    YearMonth test = YearMonth.of(Year.MAX_VALUE, 12);
    test.minusMonths(-1);
}
项目:jdk8u-jdk    文件:TCKYear.java   
@Test(dataProvider="isValidMonthDay")
public void test_isValidMonthDay(Year year, MonthDay monthDay, boolean expected) {
    assertEquals(year.isValidMonthDay(monthDay), expected);
}
项目:jdk8u-jdk    文件:TCKZoneRules.java   
public void test_London_nextTransition_lastYear() {
    ZoneRules test = europeLondon();
    List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
    ZoneOffsetTransition zot = rules.get(1).createTransition(Year.MAX_VALUE);
    assertEquals(test.nextTransition(zot.getInstant()), null);
}
项目:openjdk-jdk10    文件:TCKLocalDateTime.java   
@Test
public void constant_MIN() {
    check(LocalDateTime.MIN, Year.MIN_VALUE, 1, 1, 0, 0, 0, 0);
}
项目:jdk8u-jdk    文件:TCKLocalDateTime.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_minusWeeks_invalidTooSmall() {
    createDateMidnight(Year.MIN_VALUE, 1, 7).minusWeeks(1);
}
项目:jdk8u-jdk    文件:TestIsoWeekFields.java   
@Test(dataProvider = "fields")
public void test_WBY_rangeRefinedBy(TemporalField weekField, TemporalField yearField) {
    assertEquals(yearField.rangeRefinedBy(LocalDate.of(2012, 12, 31)), ValueRange.of(Year.MIN_VALUE, Year.MAX_VALUE));
}
项目:jdk8u-jdk    文件:TCKLocalDate.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_plusYears_long_invalidTooSmall_invalidInt() {
    LocalDate.of(Year.MIN_VALUE, 1, 1).plusYears(-10);
}
项目:openjdk-jdk10    文件:TCKLocalDateTime.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_plusMonths_int_invalidTooLarge() {
    createDateMidnight(Year.MAX_VALUE, 12, 1).plusMonths(1);
}
项目:openjdk-jdk10    文件:TCKLocalDateTime.java   
@Test(expectedExceptions=DateTimeException.class)
public void test_minus_TemporalAmount_invalidTooSmall() {
    MockSimplePeriod period = MockSimplePeriod.of(1, YEARS);
    LocalDateTime.of(Year.MIN_VALUE, 1, 1, 0, 0).minus(period);
}