當前位置: 首頁>>代碼示例>>Java>>正文


Java MonthDay.parse方法代碼示例

本文整理匯總了Java中java.time.MonthDay.parse方法的典型用法代碼示例。如果您正苦於以下問題:Java MonthDay.parse方法的具體用法?Java MonthDay.parse怎麽用?Java MonthDay.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.MonthDay的用法示例。


在下文中一共展示了MonthDay.parse方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: factory_parse_fail

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(dataProvider="badParseData", expectedExceptions=DateTimeParseException.class)
public void factory_parse_fail(String text, int pos) {
    try {
        MonthDay.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;
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:TCKMonthDay.java

示例2: factory_parse_success

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(dataProvider="goodParseData")
public void factory_parse_success(String text, MonthDay expected) {
    MonthDay monthDay = MonthDay.parse(text);
    assertEquals(monthDay, expected);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKMonthDay.java

示例3: factory_parse_illegalValue_Day

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeParseException.class)
public void factory_parse_illegalValue_Day() {
    MonthDay.parse("--06-32");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKMonthDay.java

示例4: factory_parse_invalidValue_Day

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeParseException.class)
public void factory_parse_invalidValue_Day() {
    MonthDay.parse("--06-31");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKMonthDay.java

示例5: factory_parse_illegalValue_Month

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeParseException.class)
public void factory_parse_illegalValue_Month() {
    MonthDay.parse("--13-25");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKMonthDay.java

示例6: factory_parse_nullText

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_nullText() {
    MonthDay.parse(null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKMonthDay.java

示例7: factory_parse_formatter

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void factory_parse_formatter() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("M d");
    MonthDay test = MonthDay.parse("12 3", f);
    assertEquals(test, MonthDay.of(12, 3));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:7,代碼來源:TCKMonthDay.java

示例8: factory_parse_formatter_nullText

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_formatter_nullText() {
    DateTimeFormatter f = DateTimeFormatter.ofPattern("M d");
    MonthDay.parse((String) null, f);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKMonthDay.java

示例9: factory_parse_formatter_nullFormatter

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void factory_parse_formatter_nullFormatter() {
    MonthDay.parse("ANY", null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKMonthDay.java


注:本文中的java.time.MonthDay.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。