本文整理了Java中org.openmrs.Order.getDateStopped()
方法的一些代码示例,展示了Order.getDateStopped()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Order.getDateStopped()
方法的具体详情如下:
包路径:org.openmrs.Order
类名称:Order
方法名:getDateStopped
暂无
代码示例来源:origin: openmrs/openmrs-core
/**
* A convenience method to return end of the schedule for order.
*
* @since 1.10
* @should return dateStopped if dateStopped is not null
* @should return autoExpireDate if dateStopped is null
*/
public Date getEffectiveStopDate() {
return this.getDateStopped() != null ? this.getDateStopped() : this.getAutoExpireDate();
}
代码示例来源: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#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#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActivated(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(Date)
*/
@Test
public void isActive_shouldReturnTrueIfAnOrderWasActivatedOnTheCheckDateButScheduledForTheFuture() throws Exception {
Order order = new Order();
order.setUrgency(Urgency.ON_SCHEDULED_DATE);
Date scheduledDateInFuture = DateUtils.addMonths(new Date(), 2);
order.setScheduledDate(scheduledDateInFuture);
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isExpired(java.util.Date)
*/
@Test
public void isExpired_shouldReturnFalseIfDateStoppedAndAutoExpireDateAreBothNull() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
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_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#isDiscontinued(java.util.Date)
*/
@Test
public void isDiscontinued_shouldReturnFalseIfDateStoppedAndAutoExpireDateAreBothNull() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isDiscontinued(DateUtils.parseDate("2014-11-01 11:11:11", 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#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnTrueIfAnOrderWasActivatedBeforeTheCheckDate() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertTrue(order.isActivated(DateUtils.addMonths(activationDate, 2)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForAnOrderActivatedAfterTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(DateUtils.parseDate("2014-11-01 11:11:09", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForADiscontinuationOrder() throws Exception {
Order order = new Order();
Date activationDate = DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT);
order.setDateActivated(activationDate);
order.setAction(Order.Action.DISCONTINUE);
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(activationDate));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#discontinueOrder(org.openmrs.Order, org.openmrs.Concept, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Test
public void discontinueOrder_shouldFailForAStoppedOrder() {
Order orderToDiscontinue = orderService.getOrder(1);
Encounter encounter = encounterService.getEncounter(3);
assertNotNull(orderToDiscontinue.getDateStopped());
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.discontinueOrder(orderToDiscontinue, Context.getConceptService().getConcept(1), null, null, encounter);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#discontinueOrder(org.openmrs.Order, String, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Test
public void discontinueOrder_shouldFailForADiscontinuedOrder() {
Order discontinuationOrder = orderService.getOrder(2);
assertFalse(discontinuationOrder.isActive());
assertNotNull(discontinuationOrder.getDateStopped());
Encounter encounter = encounterService.getEncounter(3);
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.discontinueOrder(discontinuationOrder, "some reason", null, null, encounter);
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActive(java.util.Date)
*/
@Test
public void isActive_shouldReturnFalseForAVoidedOrder() throws Exception {
Order order = new Order();
order.setVoided(true);
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActive(DateUtils.parseDate("2014-11-01 11:11:11", DATE_FORMAT)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see Order#isActivated(Date)
*/
@Test
public void isActivated_shouldReturnFalseForAnOrderActivatedAfterTheCheckDate() throws Exception {
Order order = new Order();
order.setDateActivated(DateUtils.parseDate("2014-11-01 11:11:10", DATE_FORMAT));
assertNull(order.getDateStopped());
assertNull(order.getAutoExpireDate());
assertFalse(order.isActivated(DateUtils.addMonths(order.getDateActivated(), -2)));
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see OrderService#discontinueOrder(org.openmrs.Order, org.openmrs.Concept, java.util.Date,
* org.openmrs.Provider, org.openmrs.Encounter)
*/
@Test
public void discontinueOrder_shouldNotPassForADiscontinuedOrder() {
Order discontinuationOrder = orderService.getOrder(2);
assertFalse(discontinuationOrder.isActive());
assertNotNull(discontinuationOrder.getDateStopped());
Encounter encounter = encounterService.getEncounter(3);
expectedException.expect(CannotStopInactiveOrderException.class);
expectedException.expectMessage(mss.getMessage("Order.cannot.discontinue.inactive"));
orderService.discontinueOrder(discontinuationOrder, (Concept) null, null, null, encounter);
}
代码示例来源: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)));
}
内容来源于网络,如有侵权,请联系作者删除!