Examples of DateMidnight


Examples of org.joda.time.DateMidnight

  }
 
  @Test
  public void timeZones() {
    LocalDate lt = new LocalDate(2000, 1, 1);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    Assert.assertEquals("2000-01-01T00:00:00.000Z", dm.toString());
  }
View Full Code Here

Examples of org.joda.time.DateMidnight

  }
 
  @Test
  public void canConvertDate_toGregorianCalendar() {
    LocalDate lt = new LocalDate(2000, 1, 2);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    XMLGregorianCalendar gc = XmlUtils.asXMLGregorianCalendar(dm.toDate());
    Assert.assertEquals("2000-01-02T00:00:00.000Z", gc.toXMLFormat());
  }
View Full Code Here

Examples of org.joda.time.DateMidnight

  }
 
  @Test
  public void canConvert_GregorianCalendar_toDate() {
    LocalDate lt = new LocalDate(2000, 1, 2);
    DateMidnight dm = lt.toDateMidnight(DateTimeZone.UTC);
   
    Date d = dm.toDate();
   
    XMLGregorianCalendar gc = XmlUtils.asXMLGregorianCalendar(d);
    Date dConv = XmlUtils.asDate(gc);
   
    Assert.assertEquals(d, dConv);
View Full Code Here

Examples of org.joda.time.DateMidnight

  @Test
  public void testParseProjectInJira4x4() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-4-4.json"));
    assertEquals("TST", project.getKey()); //2010-08-25
    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
        assertEquals("Test Project", project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issueType/1"), null, "Bug", false, null, null),
View Full Code Here

Examples of org.joda.time.DateMidnight

  @Test
  public void testParseProjectInJira5x0() throws JSONException, URISyntaxException {
    final Project project = parser.parse(ResourceUtil.getJsonObjectFromResource("/json/project/project-jira-5-0.json"));
    assertEquals("TST", project.getKey());
    assertEquals(new DateMidnight(2010, 8, 25).toInstant(), Iterables.getLast(project.getVersions()).getReleaseDate().toInstant());
    assertEquals("Test Project", project.getName());
    final OptionalIterable<IssueType> issueTypes = project.getIssueTypes();
    assertTrue(issueTypes.isSupported());
    assertThat(issueTypes, containsInAnyOrder(
        new IssueType(TestUtil.toUri("http://localhost:2990/jira/rest/api/latest/issuetype/1"), 1L, "Bug", false, "A problem which impairs or prevents the functions of the product.", TestUtil.toUri("http://localhost:2990/jira/images/icons/bug.gif")),
View Full Code Here

Examples of org.joda.time.DateMidnight

        assertEquals(true, GregorianChronology.getInstance().millisOfSecond().isSupported());
    }

    public void testMaximumValue() {
        YearMonthDay ymd1 = new YearMonthDay(1999, DateTimeConstants.FEBRUARY, 1);
        DateMidnight dm1 = new DateMidnight(1999, DateTimeConstants.FEBRUARY, 1);
        Chronology chrono = GregorianChronology.getInstance();
        assertEquals(28, chrono.dayOfMonth().getMaximumValue(ymd1));
        assertEquals(28, chrono.dayOfMonth().getMaximumValue(dm1.getMillis()));
    }
View Full Code Here

Examples of org.joda.time.DateMidnight

        assertEquals(end, start.plusMinutes(22 * 60));
        assertEquals(start, end.minusMinutes(22 * 60));
    }

    public void testMaximumValue() {
        DateMidnight dt = new DateMidnight(1570, 1, 1, GJChronology.getInstance());
        while (dt.getYear() < 1590) {
            dt = dt.plusDays(1);
            YearMonthDay ymd = dt.toYearMonthDay();
            assertEquals(dt.year().getMaximumValue(), ymd.year().getMaximumValue());
            assertEquals(dt.monthOfYear().getMaximumValue(), ymd.monthOfYear().getMaximumValue());
            assertEquals(dt.dayOfMonth().getMaximumValue(), ymd.dayOfMonth().getMaximumValue());
        }
    }
View Full Code Here

Examples of org.joda.time.DateMidnight

        assertEquals(end, start.withFieldAdded(DurationFieldType.days(), 365 + 365 + 365 + 366));
        assertEquals(start, end.withFieldAdded(DurationFieldType.days(), -(365 + 365 + 365 + 366)));
    }

    public void testMaximumValue() {
        DateMidnight dt = new DateMidnight(1570, 1, 1);
        while (dt.getYear() < 1590) {
            dt = dt.plusDays(1);
            YearMonthDay ymd = dt.toYearMonthDay();
            assertEquals(dt.year().getMaximumValue(), ymd.year().getMaximumValue());
            assertEquals(dt.monthOfYear().getMaximumValue(), ymd.monthOfYear().getMaximumValue());
            assertEquals(dt.dayOfMonth().getMaximumValue(), ymd.dayOfMonth().getMaximumValue());
        }
    }
View Full Code Here

Examples of org.joda.time.DateMidnight

    if (applyTimeZoneDifference)
    {
      TimeZone zone = getClientTimeZone();
      // instantiate now/ current time
      MutableDateTime dt = new MutableDateTime(new DateMidnight());
      if (zone != null)
      {
        // set time zone for client
        format = format.withZone(DateTimeZone.forTimeZone(zone));
        dt.setZone(DateTimeZone.forTimeZone(zone));
View Full Code Here

Examples of org.joda.time.DateMidnight

    if (applyTimeZoneDifference)
    {
      TimeZone zone = getClientTimeZone();
      // instantiate now/ current time
      MutableDateTime dt = new MutableDateTime(new DateMidnight());
      if (zone != null)
      {
        // set time zone for client
        format = format.withZone(DateTimeZone.forTimeZone(zone));
        dt.setZone(DateTimeZone.forTimeZone(zone));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.