use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class ReceiveIssueReasonValidatorTest method eventThatHasSourceAndA_reasonOfNonAdhocCategoryShouldNotPass.
@Test
public void eventThatHasSourceAndA_reasonOfNonAdhocCategoryShouldNotPass() throws Exception {
StockEventDto stockEventDto = createStockEventDto();
stockEventDto.getLineItems().get(0).setSourceId(UUID.randomUUID());
stockEventDto.getLineItems().get(0).setDestinationId(null);
stockEventDto.getLineItems().get(0).setReasonId(UUID.randomUUID());
testErrorCase(ERROR_EVENT_RECEIVE_REASON_CATEGORY_INVALID, stockEventDto, creditNonAdhocReason);
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class ReceiveIssueReasonValidatorTest method eventThatHasDestinationAndA_reasonOfNonAdhocCategoryShouldNotPass.
@Test
public void eventThatHasDestinationAndA_reasonOfNonAdhocCategoryShouldNotPass() throws Exception {
StockEventDto stockEventDto = createStockEventDto();
stockEventDto.getLineItems().get(0).setDestinationId(UUID.randomUUID());
stockEventDto.getLineItems().get(0).setSourceId(null);
stockEventDto.getLineItems().get(0).setReasonId(UUID.randomUUID());
testErrorCase(ERROR_EVENT_ISSUE_REASON_CATEGORY_INVALID, stockEventDto, debitNonAdhocReason);
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class SourceDestinationAssignmentValidatorTest method shouldPassIfProgramMissing.
@Test
public // that is handled in other validators
void shouldPassIfProgramMissing() throws Exception {
// given
StockEventDto eventDto = createStockEventDto();
createContextWithFacility(eventDto);
eventDto.setProgramId(null);
eventDto.getLineItems().get(0).setDestinationId(node.getId());
eventDto.getLineItems().get(0).setSourceId(null);
// when
sourceDestinationAssignmentValidator.validate(eventDto);
// then: no error
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class SourceDestinationAssignmentValidatorTest method shouldPassIfFacilityNotFoundInRefData.
@Test
public // that is handled in other validators
void shouldPassIfFacilityNotFoundInRefData() throws Exception {
// given
StockEventDto eventDto = createStockEventDto();
createContextWithFacility(eventDto);
eventDto.setFacilityId(null);
eventDto.getLineItems().get(0).setDestinationId(node.getId());
eventDto.getLineItems().get(0).setSourceId(null);
// when
sourceDestinationAssignmentValidator.validate(eventDto);
// then: no error
}
use of org.openlmis.stockmanagement.dto.StockEventDto in project openlmis-stockmanagement by OpenLMIS.
the class SourceDestinationAssignmentValidatorTest method shouldNotPassWhenEventHasBothSourceAndDestination.
@Test
public void shouldNotPassWhenEventHasBothSourceAndDestination() throws Exception {
// given
StockEventDto eventDto = createStockEventDto();
createContextWithFacility(eventDto);
eventDto.getLineItems().get(0).setSourceId(UUID.randomUUID());
eventDto.getLineItems().get(0).setDestinationId(UUID.randomUUID());
expectedEx.expect(ValidationMessageException.class);
expectedEx.expectMessage(containsString(ERROR_SOURCE_DESTINATION_BOTH_PRESENT));
// when
sourceDestinationAssignmentValidator.validate(eventDto);
}
Aggregations