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


Java MonthDay.of方法代碼示例

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


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

示例1: data_atMonthDay

import java.time.MonthDay; //導入方法依賴的package包/類
@DataProvider(name="atMonthDay")
Object[][] data_atMonthDay() {
    return new Object[][] {
            {Year.of(2008), MonthDay.of(6, 30), LocalDate.of(2008, 6, 30)},
            {Year.of(2008), MonthDay.of(2, 29), LocalDate.of(2008, 2, 29)},
            {Year.of(2009), MonthDay.of(2, 29), LocalDate.of(2009, 2, 28)},
    };
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:9,代碼來源:TCKYear.java

示例2: test_hashCode

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(dataProvider="sampleDates")
public void test_hashCode(int m, int d) {
    MonthDay a = MonthDay.of(m, d);
    assertEquals(a.hashCode(), a.hashCode());
    MonthDay b = MonthDay.of(m, d);
    assertEquals(a.hashCode(), b.hashCode());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:TCKMonthDay.java

示例3: test_equals

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_equals() {
    MonthDay a = MonthDay.of(1, 1);
    MonthDay b = MonthDay.of(1, 1);
    MonthDay c = MonthDay.of(2, 1);
    MonthDay d = MonthDay.of(1, 2);

    assertEquals(a.equals(a), true);
    assertEquals(a.equals(b), true);
    assertEquals(a.equals(c), false);
    assertEquals(a.equals(d), false);

    assertEquals(b.equals(a), true);
    assertEquals(b.equals(b), true);
    assertEquals(b.equals(c), false);
    assertEquals(b.equals(d), false);

    assertEquals(c.equals(a), false);
    assertEquals(c.equals(b), false);
    assertEquals(c.equals(c), true);
    assertEquals(c.equals(d), false);

    assertEquals(d.equals(a), false);
    assertEquals(d.equals(b), false);
    assertEquals(d.equals(c), false);
    assertEquals(d.equals(d), true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:28,代碼來源:TCKMonthDay.java

示例4: test_get

import java.time.MonthDay; //導入方法依賴的package包/類
@Test(dataProvider="sampleDates")
public void test_get(int m, int d) {
    MonthDay a = MonthDay.of(m, d);
    assertEquals(a.getMonth(), Month.of(m));
    assertEquals(a.getMonthValue(), m);
    assertEquals(a.getDayOfMonth(), d);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:8,代碼來源:TCKMonthDay.java

示例5: test_adjustDate

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_adjustDate() {
    MonthDay test = MonthDay.of(6, 30);
    LocalDate date = LocalDate.of(2007, 1, 1);
    assertEquals(test.adjustInto(date), LocalDate.of(2007, 6, 30));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:TCKMonthDay.java

示例6: test_adjustDate_resolve

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_adjustDate_resolve() {
    MonthDay test = MonthDay.of(2, 29);
    LocalDate date = LocalDate.of(2007, 6, 30);
    assertEquals(test.adjustInto(date), LocalDate.of(2007, 2, 28));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:TCKMonthDay.java

示例7: setUp

import java.time.MonthDay; //導入方法依賴的package包/類
@BeforeMethod
public void setUp() {
    TEST_07_15 = MonthDay.of(7, 15);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TestMonthDay.java

示例8: test_with_Month_noChangeSame

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_with_Month_noChangeSame() {
    MonthDay test = MonthDay.of(6, 30);
    assertSame(test.with(Month.JUNE), test);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TestMonthDay.java

示例9: test_factory_ints_dayTooHigh

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

示例10: test_factory_ints_monthTooLow

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

示例11: test_factory_ints_monthTooHigh

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

示例12: test_withMonth_int_noChangeSame

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_withMonth_int_noChangeSame() {
    MonthDay test = MonthDay.of(6, 30);
    assertSame(test.withMonth(6), test);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TestMonthDay.java

示例13: test_withMonth_int_noChangeEqual

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_withMonth_int_noChangeEqual() {
    MonthDay test = MonthDay.of(6, 30);
    assertEquals(test.withMonth(6), test);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKMonthDay.java

示例14: test_isValidYear_june

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_isValidYear_june() {
    MonthDay test = MonthDay.of(6, 30);
    assertEquals(test.isValidYear(2007), true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:TCKMonthDay.java

示例15: test_atYear_int_leapYearAdjust

import java.time.MonthDay; //導入方法依賴的package包/類
@Test
public void test_atYear_int_leapYearAdjust() {
    MonthDay test = MonthDay.of(2, 29);
    assertEquals(test.atYear(2005), LocalDate.of(2005, 2, 28));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:TCKMonthDay.java


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