org.joda.time.chrono.GregorianChronology源码实例Demo

类org.joda.time.chrono.GregorianChronology源码实例Demo

下面列出了org.joda.time.chrono.GregorianChronology 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: astor   文件: TestChronology.java
public void testToString() {
    DateTimeZone paris = DateTimeZone.forID("Europe/Paris");
    ISOChronology isoParis = ISOChronology.getInstance(paris);
    
    assertEquals("ISOChronology[Europe/Paris]", isoParis.toString());
    assertEquals("GJChronology[Europe/Paris]", GJChronology.getInstance(paris).toString());
    assertEquals("GregorianChronology[Europe/Paris]", GregorianChronology.getInstance(paris).toString());
    assertEquals("JulianChronology[Europe/Paris]", JulianChronology.getInstance(paris).toString());
    assertEquals("BuddhistChronology[Europe/Paris]", BuddhistChronology.getInstance(paris).toString());
    assertEquals("CopticChronology[Europe/Paris]", CopticChronology.getInstance(paris).toString());
    assertEquals("EthiopicChronology[Europe/Paris]", EthiopicChronology.getInstance(paris).toString());
    assertEquals("IslamicChronology[Europe/Paris]", IslamicChronology.getInstance(paris).toString());
    
    assertEquals("LenientChronology[ISOChronology[Europe/Paris]]", LenientChronology.getInstance(isoParis).toString());
    assertEquals("StrictChronology[ISOChronology[Europe/Paris]]", StrictChronology.getInstance(isoParis).toString());
    assertEquals("LimitChronology[ISOChronology[Europe/Paris], NoLimit, NoLimit]", LimitChronology.getInstance(isoParis, null, null).toString());
    assertEquals("ZonedChronology[ISOChronology[UTC], Europe/Paris]", ZonedChronology.getInstance(isoParis, paris).toString());
}
 
源代码2 项目: astor   文件: TestMonthDay_Basics.java
public void testIsEqual_MD() {
    MonthDay test1 = new MonthDay(6, 6);
    MonthDay test1a = new MonthDay(6, 6);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    MonthDay test2 = new MonthDay(6, 7);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    MonthDay test3 = new MonthDay(6, 7, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new MonthDay(6, 7).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码3 项目: astor   文件: TestMonthDay_Basics.java
public void testIsBefore_MD() {
    MonthDay test1 = new MonthDay(6, 6);
    MonthDay test1a = new MonthDay(6, 6);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    MonthDay test2 = new MonthDay(6, 7);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    MonthDay test3 = new MonthDay(6, 7, GregorianChronology.getInstanceUTC());
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    try {
        new MonthDay(6, 7).isBefore(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码4 项目: astor   文件: TestMonthDay_Basics.java
public void testIsAfter_MD() {
    MonthDay test1 = new MonthDay(6, 6);
    MonthDay test1a = new MonthDay(6, 6);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    MonthDay test2 = new MonthDay(6, 7);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    MonthDay test3 = new MonthDay(6, 7, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new MonthDay(6, 7).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码5 项目: astor   文件: TestLocalTime_Basics.java
public void testIsBefore_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isBefore(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码6 项目: astor   文件: TestTimeOfDay_Basics.java
public void testIsAfter_TOD() {
    TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40);
    TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new TimeOfDay(10, 20, 35, 40).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码7 项目: astor   文件: TestInstant_Basics.java
public void testIsEqual_RI() {
    Instant test1 = new Instant(TEST_TIME1);
    Instant test1a = new Instant(TEST_TIME1);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    Instant test2 = new Instant(TEST_TIME2);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    assertEquals(false, test2.isEqual(new MockInstant()));
    assertEquals(true, test1.isEqual(new MockInstant()));
    
    assertEquals(false, new Instant(TEST_TIME_NOW + 1).isEqual(null));
    assertEquals(true, new Instant(TEST_TIME_NOW).isEqual(null));
    assertEquals(false, new Instant(TEST_TIME_NOW - 1).isEqual(null));
}
 
源代码8 项目: astor   文件: TestInstant_Basics.java
public void testIsBefore_RI() {
    Instant test1 = new Instant(TEST_TIME1);
    Instant test1a = new Instant(TEST_TIME1);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    Instant test2 = new Instant(TEST_TIME2);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    assertEquals(false, test2.isBefore(new MockInstant()));
    assertEquals(false, test1.isBefore(new MockInstant()));
    
    assertEquals(false, new Instant(TEST_TIME_NOW + 1).isBefore(null));
    assertEquals(false, new Instant(TEST_TIME_NOW).isBefore(null));
    assertEquals(true, new Instant(TEST_TIME_NOW - 1).isBefore(null));
}
 
源代码9 项目: astor   文件: TestInstant_Basics.java
public void testIsAfter_RI() {
    Instant test1 = new Instant(TEST_TIME1);
    Instant test1a = new Instant(TEST_TIME1);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    Instant test2 = new Instant(TEST_TIME2);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    assertEquals(true, test2.isAfter(new MockInstant()));
    assertEquals(false, test1.isAfter(new MockInstant()));
    
    assertEquals(true, new Instant(TEST_TIME_NOW + 1).isAfter(null));
    assertEquals(false, new Instant(TEST_TIME_NOW).isAfter(null));
    assertEquals(false, new Instant(TEST_TIME_NOW - 1).isAfter(null));
}
 
源代码10 项目: astor   文件: TestYearMonth_Basics.java
public void testIsEqual_YM() {
    YearMonth test1 = new YearMonth(2005, 6);
    YearMonth test1a = new YearMonth(2005, 6);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    YearMonth test2 = new YearMonth(2005, 7);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new YearMonth(2005, 7).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码11 项目: astor   文件: TestLocalTime_Basics.java
public void testIsAfter_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码12 项目: astor   文件: TestYearMonth_Basics.java
public void testIsAfter_YM() {
    YearMonth test1 = new YearMonth(2005, 6);
    YearMonth test1a = new YearMonth(2005, 6);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    YearMonth test2 = new YearMonth(2005, 7);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new YearMonth(2005, 7).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码13 项目: astor   文件: TestYearMonth_Basics.java
public void testIsBefore_YM() {
    YearMonth test1 = new YearMonth(2005, 6);
    YearMonth test1a = new YearMonth(2005, 6);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    YearMonth test2 = new YearMonth(2005, 7);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    YearMonth test3 = new YearMonth(2005, 7, GregorianChronology.getInstanceUTC());
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    try {
        new YearMonth(2005, 7).isBefore(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码14 项目: astor   文件: TestTimeOfDay_Basics.java
public void testIsEqual_TOD() {
    TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40);
    TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new TimeOfDay(10, 20, 35, 40).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码15 项目: astor   文件: TestLocalDate_Basics.java
public void testIsAfter_LocalDate() {
    LocalDate test1 = new LocalDate(2005, 6, 2);
    LocalDate test1a = new LocalDate(2005, 6, 2);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    LocalDate test2 = new LocalDate(2005, 7, 2);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    LocalDate test3 = new LocalDate(2005, 7, 2, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new LocalDate(2005, 7, 2).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码16 项目: astor   文件: TestTimeOfDay_Basics.java
public void testIsEqual_TOD() {
    TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40);
    TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new TimeOfDay(10, 20, 35, 40).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码17 项目: astor   文件: TestTimeOfDay_Basics.java
public void testIsAfter_TOD() {
    TimeOfDay test1 = new TimeOfDay(10, 20, 30, 40);
    TimeOfDay test1a = new TimeOfDay(10, 20, 30, 40);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    TimeOfDay test2 = new TimeOfDay(10, 20, 35, 40);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    TimeOfDay test3 = new TimeOfDay(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new TimeOfDay(10, 20, 35, 40).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码18 项目: astor   文件: TestYearMonthDay_Basics.java
public void testIsEqual_YMD() {
    YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
    YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    YearMonthDay test2 = new YearMonthDay(2005, 7, 2);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new YearMonthDay(2005, 7, 2).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码19 项目: astor   文件: TestLocalTime_Basics.java
public void testIsEqual_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码20 项目: astor   文件: TestInstant_Basics.java
public void testIsAfter_RI() {
    Instant test1 = new Instant(TEST_TIME1);
    Instant test1a = new Instant(TEST_TIME1);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    Instant test2 = new Instant(TEST_TIME2);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    DateTime test3 = new DateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    assertEquals(true, test2.isAfter(new MockInstant()));
    assertEquals(false, test1.isAfter(new MockInstant()));
    
    assertEquals(true, new Instant(TEST_TIME_NOW + 1).isAfter(null));
    assertEquals(false, new Instant(TEST_TIME_NOW).isAfter(null));
    assertEquals(false, new Instant(TEST_TIME_NOW - 1).isAfter(null));
}
 
源代码21 项目: astor   文件: TestLocalTime_Basics.java
public void testIsEqual_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码22 项目: astor   文件: TestLocalTime_Basics.java
public void testIsBefore_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isBefore(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码23 项目: astor   文件: TestLocalTime_Basics.java
public void testIsAfter_LocalTime() {
    LocalTime test1 = new LocalTime(10, 20, 30, 40);
    LocalTime test1a = new LocalTime(10, 20, 30, 40);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    LocalTime test2 = new LocalTime(10, 20, 35, 40);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    LocalTime test3 = new LocalTime(10, 20, 35, 40, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    try {
        new LocalTime(10, 20, 35, 40).isAfter(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码24 项目: astor   文件: TestDateTimeZoneCutover.java
public void testBug2182444_usCentral() {
    Chronology chronUSCentral = GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
    Chronology chronUTC = GregorianChronology.getInstance(DateTimeZone.UTC);
    DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0, 0, chronUTC);
    DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0, 0, chronUTC);
    assertTrue("Should be standard time", chronUSCentral.getZone().isStandardOffset(usCentralStandardInUTC.getMillis()));
    assertFalse("Should be daylight time", chronUSCentral.getZone().isStandardOffset(usCentralDaylightInUTC.getMillis()));
    
    DateTime usCentralStandardInUSCentral = usCentralStandardInUTC.toDateTime(chronUSCentral);
    DateTime usCentralDaylightInUSCentral = usCentralDaylightInUTC.toDateTime(chronUSCentral);
    assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
    assertEquals(usCentralStandardInUSCentral.getHourOfDay(), usCentralDaylightInUSCentral.getHourOfDay());
    assertTrue(usCentralStandardInUSCentral.getMillis() != usCentralDaylightInUSCentral.getMillis());
    assertEquals(usCentralStandardInUSCentral, usCentralStandardInUSCentral.withHourOfDay(1));
    assertEquals(usCentralStandardInUSCentral.getMillis() + 3, usCentralStandardInUSCentral.withMillisOfSecond(3).getMillis());
    assertEquals(usCentralDaylightInUSCentral, usCentralDaylightInUSCentral.withHourOfDay(1));
    assertEquals(usCentralDaylightInUSCentral.getMillis() + 3, usCentralDaylightInUSCentral.withMillisOfSecond(3).getMillis());
}
 
源代码25 项目: astor   文件: TestMutableDateTime_Basics.java
public void testIsEqual() {
    MutableDateTime test1 = new MutableDateTime(TEST_TIME1);
    MutableDateTime test1a = new MutableDateTime(TEST_TIME1);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    MutableDateTime test2 = new MutableDateTime(TEST_TIME2);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    assertEquals(false, test2.isEqual(new MockInstant()));
    assertEquals(true, test1.isEqual(new MockInstant()));
    
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW + 1).isEqual(null));
    assertEquals(true, new MutableDateTime(TEST_TIME_NOW).isEqual(null));
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW - 1).isEqual(null));
}
 
源代码26 项目: astor   文件: TestMutableDateTime_Basics.java
public void testIsBefore() {
    MutableDateTime test1 = new MutableDateTime(TEST_TIME1);
    MutableDateTime test1a = new MutableDateTime(TEST_TIME1);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    MutableDateTime test2 = new MutableDateTime(TEST_TIME2);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    assertEquals(false, test2.isBefore(new MockInstant()));
    assertEquals(false, test1.isBefore(new MockInstant()));
    
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW + 1).isBefore(null));
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW).isBefore(null));
    assertEquals(true, new MutableDateTime(TEST_TIME_NOW - 1).isBefore(null));
}
 
源代码27 项目: astor   文件: TestMutableDateTime_Basics.java
public void testIsAfter() {
    MutableDateTime test1 = new MutableDateTime(TEST_TIME1);
    MutableDateTime test1a = new MutableDateTime(TEST_TIME1);
    assertEquals(false, test1.isAfter(test1a));
    assertEquals(false, test1a.isAfter(test1));
    assertEquals(false, test1.isAfter(test1));
    assertEquals(false, test1a.isAfter(test1a));
    
    MutableDateTime test2 = new MutableDateTime(TEST_TIME2);
    assertEquals(false, test1.isAfter(test2));
    assertEquals(true, test2.isAfter(test1));
    
    MutableDateTime test3 = new MutableDateTime(TEST_TIME2, GregorianChronology.getInstance(PARIS));
    assertEquals(false, test1.isAfter(test3));
    assertEquals(true, test3.isAfter(test1));
    assertEquals(false, test3.isAfter(test2));
    
    assertEquals(true, test2.isAfter(new MockInstant()));
    assertEquals(false, test1.isAfter(new MockInstant()));
    
    assertEquals(true, new MutableDateTime(TEST_TIME_NOW + 1).isAfter(null));
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW).isAfter(null));
    assertEquals(false, new MutableDateTime(TEST_TIME_NOW - 1).isAfter(null));
}
 
源代码28 项目: astor   文件: TestDateTimeZoneCutover.java
public void testBug2182444_usCentral() {
    Chronology chronUSCentral = GregorianChronology.getInstance(DateTimeZone.forID("US/Central"));
    Chronology chronUTC = GregorianChronology.getInstance(DateTimeZone.UTC);
    DateTime usCentralStandardInUTC = new DateTime(2008, 11, 2, 7, 0, 0, 0, chronUTC);
    DateTime usCentralDaylightInUTC = new DateTime(2008, 11, 2, 6, 0, 0, 0, chronUTC);
    assertTrue("Should be standard time", chronUSCentral.getZone().isStandardOffset(usCentralStandardInUTC.getMillis()));
    assertFalse("Should be daylight time", chronUSCentral.getZone().isStandardOffset(usCentralDaylightInUTC.getMillis()));
    
    DateTime usCentralStandardInUSCentral = usCentralStandardInUTC.toDateTime(chronUSCentral);
    DateTime usCentralDaylightInUSCentral = usCentralDaylightInUTC.toDateTime(chronUSCentral);
    assertEquals(1, usCentralStandardInUSCentral.getHourOfDay());
    assertEquals(usCentralStandardInUSCentral.getHourOfDay(), usCentralDaylightInUSCentral.getHourOfDay());
    assertTrue(usCentralStandardInUSCentral.getMillis() != usCentralDaylightInUSCentral.getMillis());
    assertEquals(usCentralStandardInUSCentral, usCentralStandardInUSCentral.withHourOfDay(1));
    assertEquals(usCentralStandardInUSCentral.getMillis() + 3, usCentralStandardInUSCentral.withMillisOfSecond(3).getMillis());
    assertEquals(usCentralDaylightInUSCentral, usCentralDaylightInUSCentral.withHourOfDay(1));
    assertEquals(usCentralDaylightInUSCentral.getMillis() + 3, usCentralDaylightInUSCentral.withMillisOfSecond(3).getMillis());
}
 
源代码29 项目: astor   文件: TestLocalDate_Basics.java
public void testIsBefore_LocalDate() {
    LocalDate test1 = new LocalDate(2005, 6, 2);
    LocalDate test1a = new LocalDate(2005, 6, 2);
    assertEquals(false, test1.isBefore(test1a));
    assertEquals(false, test1a.isBefore(test1));
    assertEquals(false, test1.isBefore(test1));
    assertEquals(false, test1a.isBefore(test1a));
    
    LocalDate test2 = new LocalDate(2005, 7, 2);
    assertEquals(true, test1.isBefore(test2));
    assertEquals(false, test2.isBefore(test1));
    
    LocalDate test3 = new LocalDate(2005, 7, 2, GregorianChronology.getInstanceUTC());
    assertEquals(true, test1.isBefore(test3));
    assertEquals(false, test3.isBefore(test1));
    assertEquals(false, test3.isBefore(test2));
    
    try {
        new LocalDate(2005, 7, 2).isBefore(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
源代码30 项目: astor   文件: TestYearMonthDay_Basics.java
public void testIsEqual_YMD() {
    YearMonthDay test1 = new YearMonthDay(2005, 6, 2);
    YearMonthDay test1a = new YearMonthDay(2005, 6, 2);
    assertEquals(true, test1.isEqual(test1a));
    assertEquals(true, test1a.isEqual(test1));
    assertEquals(true, test1.isEqual(test1));
    assertEquals(true, test1a.isEqual(test1a));
    
    YearMonthDay test2 = new YearMonthDay(2005, 7, 2);
    assertEquals(false, test1.isEqual(test2));
    assertEquals(false, test2.isEqual(test1));
    
    YearMonthDay test3 = new YearMonthDay(2005, 7, 2, GregorianChronology.getInstanceUTC());
    assertEquals(false, test1.isEqual(test3));
    assertEquals(false, test3.isEqual(test1));
    assertEquals(true, test3.isEqual(test2));
    
    try {
        new YearMonthDay(2005, 7, 2).isEqual(null);
        fail();
    } catch (IllegalArgumentException ex) {}
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 类方法
 同包方法