当前位置: 首页>>代码示例>>Java>>正文


Java LocalDate.plusYears方法代码示例

本文整理汇总了Java中java.time.LocalDate.plusYears方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDate.plusYears方法的具体用法?Java LocalDate.plusYears怎么用?Java LocalDate.plusYears使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.plusYears方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldSelectMultipleDates

import java.time.LocalDate; //导入方法依赖的package包/类
@Test
public void shouldSelectMultipleDates() {
    // Given
    LocalDate now = LocalDate.now();
    LocalDate tomorrow = now.plusDays(1);
    LocalDate dayAfterTomorrow = tomorrow.plusDays(1);
    LocalDate oneYearAfter = dayAfterTomorrow.plusYears(1);
    DateSelectionModel model = new DateSelectionModel();
    model.setSelectionMode(SelectionMode.MULTIPLE_DATES);

    // When
    model.selectRange(now, dayAfterTomorrow);
    model.select(oneYearAfter);

    // Then
    assertFalse(model.isEmpty());
    assertThat(model.getSelectedDates(), is(not(empty())));
    assertThat(model.getSelectedDates().size(), is(equalTo(4)));
    assertThat(model.getSelectedDates(), contains(now, tomorrow, dayAfterTomorrow, oneYearAfter));
    assertThat(model.getLastSelected(), is(equalTo(oneYearAfter)));
    assertTrue(model.isSelected(now));
    assertTrue(model.isSelected(tomorrow));
    assertTrue(model.isSelected(dayAfterTomorrow));
    assertTrue(model.isSelected(oneYearAfter));
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:26,代码来源:DateSelectionModelTests.java

示例2: testFilter1

import java.time.LocalDate; //导入方法依赖的package包/类
@Test()
public void testFilter1() {
    final LocalDate start = LocalDate.of(2000, 1, 1);
    final LocalDate end = start.plusYears(10);
    final Index<LocalDate> dates = Range.of(start, end).toIndex(LocalDate.class);
    final Index<String> strings = Range.of(0, 100).map(i -> "Column-" +i).toIndex(String.class);
    final DataFrame<String,LocalDate> frame = DataFrame.ofDoubles(strings, dates);
    frame.applyDoubles(v -> Math.random() * 100);
    final DataFrameColumns<String,LocalDate> filter = frame.cols().filter(Arrays.asList(dates.getKey(0), dates.getKey(25), dates.getKey(102), dates.getKey(456)));
    Assert.assertEquals(filter.count(), 4, "Column count matches expected column count");
    filter.forEach(column -> column.forEachValue(v -> {
        final double actual = v.getDouble();
        final double expected = frame.data().getDouble(v.rowKey(), v.colKey());
        Assert.assertEquals(actual, expected, "The value matches for " + v);
    }));
}
 
开发者ID:zavtech,项目名称:morpheus-core,代码行数:17,代码来源:ColumnTests.java

示例3: call

import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public LocalDate call(LocalDate payload) {
    if ("banan".equals(headers.getHeaderString(Constants.USERTOKENID_HEADER))) {
        return payload.plusYears(1);
    } else {
        return payload;
    }
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:9,代码来源:StubGeneratorTest.java

示例4: call

import java.time.LocalDate; //导入方法依赖的package包/类
@Override
public LocalDate call(LocalDate payload) {
    String usertoken = headers.getHeaderString(Constants.USERTOKENID_HEADER);
    if ("banan".equals(usertoken)) {
        return payload.plusYears(1);
    } else {
        return payload;
    }
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:10,代码来源:TargetGeneratorTest.java

示例5: test_plusYears_long_invalidTooLarge

import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_plusYears_long_invalidTooLarge() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 6, 1);
    test.plusYears(1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKLocalDate.java

示例6: test_plusYears_long_invalidTooLargeMaxAddMax

import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_plusYears_long_invalidTooLargeMaxAddMax() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 12, 1);
    test.plusYears(Long.MAX_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKLocalDate.java

示例7: test_plusYears_long_invalidTooLargeMaxAddMin

import java.time.LocalDate; //导入方法依赖的package包/类
@Test(expectedExceptions=DateTimeException.class)
public void test_plusYears_long_invalidTooLargeMaxAddMin() {
    LocalDate test = LocalDate.of(Year.MAX_VALUE, 12, 1);
    test.plusYears(Long.MIN_VALUE);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:6,代码来源:TCKLocalDate.java


注:本文中的java.time.LocalDate.plusYears方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。