Search in sources :

Example 16 with DateRange

use of com.qcadoo.commons.dateTime.DateRange in project mes by qcadoo.

the class OrderDatesServiceTest method shouldReturnDateRangeWithEffectiveEndDate4.

@Test
public final void shouldReturnDateRangeWithEffectiveEndDate4() {
    // given
    Date effectiveEndDate = new DateTime(2013, 2, 8, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.EFFECTIVE_DATE_TO, effectiveEndDate);
    // when
    DateRange dateRange = orderDatesService.getCalculatedDates(order);
    // then
    assertNull(dateRange.getFrom());
    assertEquals(effectiveEndDate, dateRange.getTo());
}
Also used : DateRange(com.qcadoo.commons.dateTime.DateRange) Date(java.util.Date) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 17 with DateRange

use of com.qcadoo.commons.dateTime.DateRange in project mes by qcadoo.

the class OrderDatesServiceTest method shouldReturnDateRangeWithEffectiveEndDate.

@Test
public final void shouldReturnDateRangeWithEffectiveEndDate() {
    // given
    Date plannedEndDate = new DateTime(2013, 1, 1, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.DATE_TO, plannedEndDate);
    Date correctedEndDate = new DateTime(2013, 1, 5, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.CORRECTED_DATE_TO, correctedEndDate);
    Date effectiveEndDate = new DateTime(2013, 2, 8, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.EFFECTIVE_DATE_TO, effectiveEndDate);
    // when
    DateRange dateRange = orderDatesService.getCalculatedDates(order);
    // then
    assertNull(dateRange.getFrom());
    assertEquals(effectiveEndDate, dateRange.getTo());
}
Also used : DateRange(com.qcadoo.commons.dateTime.DateRange) Date(java.util.Date) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 18 with DateRange

use of com.qcadoo.commons.dateTime.DateRange in project mes by qcadoo.

the class OrderDatesServiceTest method shouldReturnDateRangeWithPlannedStartAndPlannedEndDate.

@Test
public final void shouldReturnDateRangeWithPlannedStartAndPlannedEndDate() {
    // given
    Date plannedStartDate = new DateTime(2012, 12, 30, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.DATE_FROM, plannedStartDate);
    Date plannedEndDate = new DateTime(2013, 1, 1, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.DATE_TO, plannedEndDate);
    // when
    DateRange dateRange = orderDatesService.getCalculatedDates(order);
    // then
    assertEquals(plannedStartDate, dateRange.getFrom());
    assertEquals(plannedEndDate, dateRange.getTo());
}
Also used : DateRange(com.qcadoo.commons.dateTime.DateRange) Date(java.util.Date) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 19 with DateRange

use of com.qcadoo.commons.dateTime.DateRange in project mes by qcadoo.

the class OrderDatesServiceTest method shouldReturnDateRangeWithEffectiveStartDate4.

@Test
public final void shouldReturnDateRangeWithEffectiveStartDate4() {
    // given
    Date effectiveStartDate = new DateTime(2013, 2, 8, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.EFFECTIVE_DATE_FROM, effectiveStartDate);
    // when
    DateRange dateRange = orderDatesService.getCalculatedDates(order);
    // then
    assertEquals(effectiveStartDate, dateRange.getFrom());
    assertNull(dateRange.getTo());
}
Also used : DateRange(com.qcadoo.commons.dateTime.DateRange) Date(java.util.Date) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 20 with DateRange

use of com.qcadoo.commons.dateTime.DateRange in project mes by qcadoo.

the class OrderDatesServiceTest method shouldReturnDateRangeWithPlannedEndDate.

@Test
public final void shouldReturnDateRangeWithPlannedEndDate() {
    // given
    Date plannedEndDate = new DateTime(2013, 1, 1, 0, 0, 0, 0).toDate();
    stubDateField(order, OrderFields.DATE_TO, plannedEndDate);
    // when
    DateRange dateRange = orderDatesService.getCalculatedDates(order);
    // then
    assertNull(dateRange.getFrom());
    assertEquals(plannedEndDate, dateRange.getTo());
}
Also used : DateRange(com.qcadoo.commons.dateTime.DateRange) Date(java.util.Date) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Aggregations

DateRange (com.qcadoo.commons.dateTime.DateRange)29 Test (org.junit.Test)25 Date (java.util.Date)24 DateTime (org.joda.time.DateTime)20 Entity (com.qcadoo.model.api.Entity)2 Shift (com.qcadoo.mes.basic.shift.Shift)1 EntityList (com.qcadoo.model.api.EntityList)1 LocalTime (org.joda.time.LocalTime)1