Example usage for org.jfree.data.time Month getYear

List of usage examples for org.jfree.data.time Month getYear

Introduction

In this page you can find the example usage for org.jfree.data.time Month getYear.

Prototype

public Year getYear() 

Source Link

Document

Returns the year in which the month falls.

Usage

From source file:org.jfree.data.time.MonthTest.java

/**
 * Some checks for the testNext() method.
 *//*from  w ww .ja v a2s.  c  o  m*/
@Test
public void testNext() {
    Month m = new Month(12, 2000);
    m = (Month) m.next();
    assertEquals(new Year(2001), m.getYear());
    assertEquals(1, m.getMonth());
    m = new Month(12, 9999);
    assertNull(m.next());
}

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * Some checks for the testNext() method.
 */// w ww  . j ava2s  .  c o m
public void testNext() {
    Month m = new Month(12, 2000);
    m = (Month) m.next();
    assertEquals(new Year(2001), m.getYear());
    assertEquals(1, m.getMonth());
    m = new Month(12, 9999);
    assertNull(m.next());
}

From source file:org.jfree.data.time.MonthTest.java

/**
 * Tests the string parsing code.../*from ww w.  j av  a 2  s  .c o  m*/
 */
@Test
public void testParseMonth() {

    Month month = null;

    // test 1...
    try {
        month = Month.parseMonth("1990-01");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(1, month.getMonth());
    assertEquals(1990, month.getYear().getYear());

    // test 2...
    try {
        month = Month.parseMonth("02-1991");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(2, month.getMonth());
    assertEquals(1991, month.getYear().getYear());

    // test 3...
    try {
        month = Month.parseMonth("March 1993");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(3, month.getMonth());
    assertEquals(1993, month.getYear().getYear());

}

From source file:org.jfree.data.time.junit.MonthTest.java

/**
 * Tests the string parsing code...//  www  .j  av a  2 s .  c om
 */
public void testParseMonth() {

    Month month;

    // test 1...
    try {
        month = Month.parseMonth("1990-01");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(1, month.getMonth());
    assertEquals(1990, month.getYear().getYear());

    // test 2...
    try {
        month = Month.parseMonth("02-1991");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(2, month.getMonth());
    assertEquals(1991, month.getYear().getYear());

    // test 3...
    try {
        month = Month.parseMonth("March 1993");
    } catch (TimePeriodFormatException e) {
        month = new Month(1, 1900);
    }
    assertEquals(3, month.getMonth());
    assertEquals(1993, month.getYear().getYear());

}