Java 类org.jfree.data.time.Quarter 实例源码

项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623347200000L, q.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Quarter q = new Quarter(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(978307200000L, q.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-615488400001L, q.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Quarter q = new Quarter(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(1001890799999L, q.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-623347200000L, q.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Quarter q = new Quarter(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(978307200000L, q.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-615488400001L, q.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Quarter q = new Quarter(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(1001890799999L, q.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:QuarterTests.java   
/**
 * In GMT, the end of Q1 2002 is java.util.Date(1017619199999L).  Use this
 * to check the quarter constructor.
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Calendar c = new GregorianCalendar(zone);
    Quarter q1 = new Quarter(new Date(1017619199999L), zone, 
            Locale.getDefault());
    Quarter q2 = new Quarter(new Date(1017619200000L), zone, 
            Locale.getDefault());

    assertEquals(1, q1.getQuarter());
    assertEquals(1017619199999L, q1.getLastMillisecond(c));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017619200000L, q2.getFirstMillisecond(c));

}
项目:astor    文件:QuarterTests.java   
/**
 * In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L).  Use
 * this to check the quarter constructor.
 */
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
    Calendar c = new GregorianCalendar(zone);
    Quarter q1 = new Quarter(new Date(1017608399999L), zone, 
            Locale.getDefault());
    Quarter q2 = new Quarter(new Date(1017608400000L), zone, 
            Locale.getDefault());

    assertEquals(1, q1.getQuarter());
    assertEquals(1017608399999L, q1.getLastMillisecond(c));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017608400000L, q2.getFirstMillisecond(c));

}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-623347200000L, q.getFirstMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Quarter q = new Quarter(1, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, q.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Quarter q = new Quarter(2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar c = new GregorianCalendar(zone);
    assertEquals(-615488400001L, q.getLastMillisecond(c));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Quarter q = new Quarter(3, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(1001894399999L, q.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        q.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:PeriodAxisTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    PeriodAxis a1 = new PeriodAxis("Test");
    PeriodAxis a2 = new PeriodAxis("Test");
    assertTrue(a1.equals(a2));
    assertTrue(a2.equals(a1));

    a1.setFirst(new Year(2000));
    assertFalse(a1.equals(a2));
    a2.setFirst(new Year(2000));
    assertTrue(a1.equals(a2));

    a1.setLast(new Year(2004));
    assertFalse(a1.equals(a2));
    a2.setLast(new Year(2004));
    assertTrue(a1.equals(a2));

    a1.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    assertFalse(a1.equals(a2));
    a2.setTimeZone(TimeZone.getTimeZone("Pacific/Auckland"));
    assertTrue(a1.equals(a2));

    a1.setAutoRangeTimePeriodClass(Quarter.class);
    assertFalse(a1.equals(a2));
    a2.setAutoRangeTimePeriodClass(Quarter.class);
    assertTrue(a1.equals(a2));

    PeriodAxisLabelInfo info[] = new PeriodAxisLabelInfo[1];
    info[0] = new PeriodAxisLabelInfo(Month.class, "MMM");

    a1.setLabelInfo(info);
    assertFalse(a1.equals(a2));
    a2.setLabelInfo(info);
    assertTrue(a1.equals(a2));
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Common test setup.
 */
protected void setUp() {
    this.q1Y1900 = new Quarter(1, 1900);
    this.q2Y1900 = new Quarter(2, 1900);
    this.q3Y9999 = new Quarter(3, 9999);
    this.q4Y9999 = new Quarter(4, 9999);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * In GMT, the end of Q1 2002 is java.util.Date(1017619199999L).  Use this to check the
 * quarter constructor.
 */
public void testDateConstructor1() {

    final TimeZone zone = TimeZone.getTimeZone("GMT");
    final Quarter q1 = new Quarter(new Date(1017619199999L), zone);
    final Quarter q2 = new Quarter(new Date(1017619200000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017619199999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017619200000L, q2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L).  Use this to check the
 * quarter constructor.
 */
public void testDateConstructor2() {

    final TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
    final Quarter q1 = new Quarter(new Date(1017608399999L), zone);
    final Quarter q2 = new Quarter(new Date(1017608400000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017608399999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    final Quarter q1 = new Quarter(2, 2003);
    final Quarter q2 = new Quarter(2, 2003);
    assertTrue(q1.equals(q2));
    final int h1 = q1.hashCode();
    final int h2 = q2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Common test setup.
 */
protected void setUp() {
    this.q1Y1900 = new Quarter(1, 1900);
    this.q2Y1900 = new Quarter(2, 1900);
    this.q3Y9999 = new Quarter(3, 9999);
    this.q4Y9999 = new Quarter(4, 9999);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * In GMT, the end of Q1 2002 is java.util.Date(1017619199999L).  Use this
 * to check the quarter constructor.
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Quarter q1 = new Quarter(new Date(1017619199999L), zone);
    Quarter q2 = new Quarter(new Date(1017619200000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017619199999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017619200000L, q2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L).  Use
 * this to check the quarter constructor.
 */
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
    Quarter q1 = new Quarter(new Date(1017608399999L), zone);
    Quarter q2 = new Quarter(new Date(1017608400000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017608399999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    Quarter q1 = new Quarter(2, 2003);
    Quarter q2 = new Quarter(2, 2003);
    assertTrue(q1.equals(q2));
    int h1 = q1.hashCode();
    int h2 = q2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond() method.
 */
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Quarter q = new Quarter(3, 1970);
    assertEquals(15634800000L, q.getFirstMillisecond());
    Locale.setDefault(saved);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond() method.
 */
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Quarter q = new Quarter(3, 1970);
    assertEquals(23583599999L, q.getLastMillisecond());
    Locale.setDefault(saved);
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getStart() method.
 */
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JULY, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Quarter q = new Quarter(3, 2006);
    assertEquals(cal.getTime(), q.getStart());
    Locale.setDefault(saved);        
}
项目:parabuild-ci    文件:QuarterTests.java   
/**
 * Some checks for the getEnd() method.
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.MARCH, 31, 23, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Quarter q = new Quarter(1, 2006);
    assertEquals(cal.getTime(), q.getEnd());
    Locale.setDefault(saved);                
}
项目:nabs    文件:QuarterTests.java   
/**
 * Common test setup.
 */
protected void setUp() {
    this.q1Y1900 = new Quarter(1, 1900);
    this.q2Y1900 = new Quarter(2, 1900);
    this.q3Y9999 = new Quarter(3, 9999);
    this.q4Y9999 = new Quarter(4, 9999);
}
项目:nabs    文件:QuarterTests.java   
/**
 * In GMT, the end of Q1 2002 is java.util.Date(1017619199999L).  Use this
 * to check the quarter constructor.
 */
public void testDateConstructor1() {

    TimeZone zone = TimeZone.getTimeZone("GMT");
    Quarter q1 = new Quarter(new Date(1017619199999L), zone);
    Quarter q2 = new Quarter(new Date(1017619200000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017619199999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017619200000L, q2.getFirstMillisecond(zone));

}
项目:nabs    文件:QuarterTests.java   
/**
 * In Istanbul, the end of Q1 2002 is java.util.Date(1017608399999L).  Use
 * this to check the quarter constructor.
 */
public void testDateConstructor2() {

    TimeZone zone = TimeZone.getTimeZone("Europe/Istanbul");
    Quarter q1 = new Quarter(new Date(1017608399999L), zone);
    Quarter q2 = new Quarter(new Date(1017608400000L), zone);

    assertEquals(1, q1.getQuarter());
    assertEquals(1017608399999L, q1.getLastMillisecond(zone));

    assertEquals(2, q2.getQuarter());
    assertEquals(1017608400000L, q2.getFirstMillisecond(zone));

}
项目:nabs    文件:QuarterTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashcode() {
    Quarter q1 = new Quarter(2, 2003);
    Quarter q2 = new Quarter(2, 2003);
    assertTrue(q1.equals(q2));
    int h1 = q1.hashCode();
    int h2 = q2.hashCode();
    assertEquals(h1, h2);
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond() method.
 */
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Quarter q = new Quarter(3, 1970);
    assertEquals(15634800000L, q.getFirstMillisecond());
    Locale.setDefault(saved);
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond() method.
 */
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    Quarter q = new Quarter(3, 1970);
    assertEquals(23583599999L, q.getLastMillisecond());
    Locale.setDefault(saved);
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getStart() method.
 */
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JULY, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Quarter q = new Quarter(3, 2006);
    assertEquals(cal.getTime(), q.getStart());
    Locale.setDefault(saved);        
}
项目:nabs    文件:QuarterTests.java   
/**
 * Some checks for the getEnd() method.
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.MARCH, 31, 23, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Quarter q = new Quarter(1, 2006);
    assertEquals(cal.getTime(), q.getEnd());
    Locale.setDefault(saved);                
}
项目:astor    文件:QuarterTests.java   
/**
 * Common test setup.
 */
protected void setUp() {
    this.q1Y1900 = new Quarter(1, 1900);
    this.q2Y1900 = new Quarter(2, 1900);
    this.q3Y9999 = new Quarter(3, 9999);
    this.q4Y9999 = new Quarter(4, 9999);
}
项目:astor    文件:QuarterTests.java   
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashcode() {
    Quarter q1 = new Quarter(2, 2003);
    Quarter q2 = new Quarter(2, 2003);
    assertTrue(q1.equals(q2));
    int h1 = q1.hashCode();
    int h2 = q2.hashCode();
    assertEquals(h1, h2);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getFirstMillisecond() method.
 */
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Quarter q = new Quarter(3, 1970);
    assertEquals(15634800000L, q.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getLastMillisecond() method.
 */
public void testGetLastMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Quarter q = new Quarter(3, 1970);
    assertEquals(23583599999L, q.getLastMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}
项目:astor    文件:QuarterTests.java   
/**
 * Some checks for the getStart() method.
 */
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JULY, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Quarter q = new Quarter(3, 2006);
    assertEquals(cal.getTime(), q.getStart());
    Locale.setDefault(saved);
}