本文整理了Java中org.openmrs.Order.setAutoExpireDate()
方法的一些代码示例,展示了Order.setAutoExpireDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.setAutoExpireDate()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:setAutoExpireDate
暂无
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(Date)
*/
@Test
public void isDiscontinued_shouldNotDiscontinueActivatedOrderBeforeAutoExpireDate() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
assertFalse("shouldn't be discontinued before autoExpireDate", o.isDiscontinued(ymd.parse("2007-10-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(Date)
*/
@Test
public void isDiscontinued_shouldNotDiscontinueActivatedOrderAfterAutoExpireDate() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
assertFalse("shouldn't be discontinued after autoExpireDate", o.isDiscontinued(ymd.parse("2008-10-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(Date)
*/
@Test
public void isDiscontinued_shouldDiscontinueActivatedOrderAfterDateStopped() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
OrderUtilTest.setDateStopped(o, ymd.parse("2007-11-01"));
assertTrue("should be discontinued after dateStopped", o.isDiscontinued(ymd.parse("2007-11-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(Date)
*/
@Test
public void isDiscontinued_shouldNotDiscontinueActivatedOrderBeforeDateStopped() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
OrderUtilTest.setDateStopped(o, ymd.parse("2007-11-01"));
assertFalse("shouldn't be discontinued before dateStopped", o.isDiscontinued(ymd.parse("2007-10-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive()
*/
@Test
public void isActive_shouldBeCurrentBetweenDateActivatedAndAutoExpireDate() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
assertFalse("shouldn't be current before dateActivated", o.isActive(ymd.parse("2006-10-26")));
assertTrue("should be current between dateActivated and autoExpireDate", o.isActive(ymd.parse("2007-10-26")));
assertFalse("shouldn't be current after autoExpireDate", o.isActive(ymd.parse("2008-10-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive()
*/
@Test
public void isActive_shouldBeCurrentBetweenDateActivatedAndDateStopped() throws Exception {
o.setDateActivated(ymd.parse("2007-01-01"));
o.setAutoExpireDate(ymd.parse("2007-12-31"));
OrderUtilTest.setDateStopped(o, ymd.parse("2007-11-01"));
assertFalse("shouldn't be current before dateActivated", o.isActive(ymd.parse("2006-10-26")));
assertTrue("should be current between dateActivated and dateStopped", o.isActive(ymd.parse("2007-10-26")));
assertFalse("shouldn't be current after dateStopped", o.isActive(ymd.parse("2007-11-26")));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#getEffectiveStopDate()
*/
@Test
public void getEffectiveStopDate_shouldReturnDateStoppedIfDateStoppedIsNotNull() throws Exception {
Order order = new Order();
Date dateStopped = DateUtils.addDays(new Date(), 4);
OrderUtilTest.setDateStopped(order, dateStopped);
order.setAutoExpireDate(new Date());
assertEquals(dateStopped, order.getEffectiveStopDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#getEffectiveStopDate()
*/
@Test
public void getEffectiveStopDate_shouldReturnAutoExpireDateIfDateStoppedIsNull() throws Exception {
Order order = new Order();
Date date = DateUtils.addDays(new Date(), 4);
order.setAutoExpireDate(date);
assertEquals(date, order.getEffectiveStopDate());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForAnExpiredOrder() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertFalse(order.isActive(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnTrueIfAnOrderExpiredOnTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
Date checkDate = DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT);
order.setAutoExpireDate(checkDate);
assertNull(order.getDateStopped());
assertTrue(order.isActive(checkDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfDateStoppedIsNullAndAutoExpireDateIsEqualToCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
Date checkDate = DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT);
order.setAutoExpireDate(checkDate);
assertNull(order.getDateStopped());
assertFalse(order.isExpired(checkDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnTrueIfCheckDateIsAfterDateStoppedButBeforeAutoExpireDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT));
assertTrue(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfCheckDateIsAfterBothDateStoppedAutoExpireDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfDateStoppedIsNullAndAutoExpireDateIsAfterCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
assertNull(order.getDateStopped());
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfCheckDateIsAfterDateStoppedButBeforeAutoExpireDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT));
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnTrueIfCheckDateIsAfterBothDateStoppedAutoExpireDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
assertTrue(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfDateActivatedIsAfterCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT));
assertNull(order.getDateStopped());
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnTrueIfDateStoppedIsNullAndAutoExpireDateIsBeforeCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
assertNull(order.getDateStopped());
assertTrue(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseForAVoidedOrder() throws Exception {
Order order = new Order();
order.setVoided(true);
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertFalse(order.isExpired(DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldFailIfDateStoppedIsAfterAutoExpireDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
order.setAutoExpireDate(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT));
OrderUtilTest.setDateStopped(order, DateUtils.parseDate("2014-11-01 11:11:12", DATE_FORMAT));
expectedException.expect(APIException.class);
expectedException.expectMessage(
Context.getMessageSourceService().getMessage("Order.error.invalidDateStoppedAndAutoExpireDate"));
order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:13", DATE_FORMAT));
}
内容来源于网络,如有侵权,请联系作者删除!