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


Java AbstractChronology类代码示例

本文整理汇总了Java中java.time.chrono.AbstractChronology的典型用法代码示例。如果您正苦于以下问题:Java AbstractChronology类的具体用法?Java AbstractChronology怎么用?Java AbstractChronology使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: shouldNotParseNull

import java.time.chrono.AbstractChronology; //导入依赖的package包/类
@Test(expected = DateTimeException.class)
public void shouldNotParseNull() {

    // given
    List<DatePattern> patterns = Arrays.asList(new DatePattern("M/d/yyyy"), new DatePattern("dd-MMM-yyyy"));
    AbstractChronology chronology = DateCalendarConverter.CalendarUnit.ISO.getCalendarType();
    Locale locale = Locale.US;

    // then
    parseDateFromPatterns(null, patterns, chronology, locale);

}
 
开发者ID:Talend,项目名称:data-prep,代码行数:13,代码来源:DateCalendarConverterTest.java

示例2: testEmptyListPatterns

import java.time.chrono.AbstractChronology; //导入依赖的package包/类
@Test(expected = DateTimeException.class)
public void testEmptyListPatterns() {

    // given
    String value = "02-Dec-197";
    List<DatePattern> patterns = new ArrayList<>();
    AbstractChronology chronology = DateCalendarConverter.CalendarUnit.ISO.getCalendarType();
    Locale locale = Locale.US;

    // then
    parseDateFromPatterns(value, patterns, chronology, locale);

}
 
开发者ID:Talend,项目名称:data-prep,代码行数:14,代码来源:DateCalendarConverterTest.java

示例3: testWrongPatterns

import java.time.chrono.AbstractChronology; //导入依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testWrongPatterns() {

    // given
    String value = "02-Dec-197";
    List<DatePattern> patterns = Arrays.asList(new DatePattern("a/bb/cccc"), new DatePattern("tt/zzz/fffff"));
    AbstractChronology chronology = DateCalendarConverter.CalendarUnit.ISO.getCalendarType();
    Locale locale = Locale.US;

    // then
    parseDateFromPatterns(value, patterns, chronology, locale);

}
 
开发者ID:Talend,项目名称:data-prep,代码行数:14,代码来源:DateCalendarConverterTest.java

示例4: testLitteralMonthsParseDateFromPatterns

import java.time.chrono.AbstractChronology; //导入依赖的package包/类
@Test
public void testLitteralMonthsParseDateFromPatterns() {

    List<DatePattern> patterns = Arrays.asList(new DatePattern("M/d/yyyy"), new DatePattern("dd-MMM-yyyy"),
            new DatePattern("MMMM d, yyyy"), new DatePattern("d MMMM yyyy"));
    AbstractChronology chronology = DateCalendarConverter.CalendarUnit.ISO.getCalendarType();

    // given
    String valueWithMonthInCapital = "02-FEB-1978";

    Locale localeUS = Locale.US;

    // then
    assertEquals(patterns.get(1).getPattern(),
            parseDateFromPatterns(valueWithMonthInCapital, patterns, chronology, localeUS));

    // given
    String valueMonthUSShortLitteral = "02-Dec-1997";

    // then
    assertEquals(patterns.get(1).getPattern(),
            parseDateFromPatterns(valueMonthUSShortLitteral, patterns, chronology, localeUS));

    // given
    String valueMonthUSLongLitteral = "2 February 1981";

    // then
    assertEquals(patterns.get(3).getPattern(),
            parseDateFromPatterns(valueMonthUSLongLitteral, patterns, chronology, localeUS));

    // given
    String valueMonthUSLongLitteral2 = "December 3, 2004";

    // then
    assertEquals(patterns.get(2).getPattern(),
            parseDateFromPatterns(valueMonthUSLongLitteral2, patterns, chronology, localeUS));

    // given
    Locale localeFr = Locale.FRANCE;
    String valueMonthFrLongLitteral = "4 Février 2030";

    // then
    assertEquals(patterns.get(3).getPattern(),
            parseDateFromPatterns(valueMonthFrLongLitteral, patterns, chronology, localeFr));

}
 
开发者ID:Talend,项目名称:data-prep,代码行数:47,代码来源:DateCalendarConverterTest.java


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