use of org.openlmis.stockmanagement.dto.StockCardTemplateDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardTemplateServiceTest method shouldGetDefaultStockCardTemplate.
@Test
public void shouldGetDefaultStockCardTemplate() {
// when
StockCardTemplateDto template = stockCardTemplateService.getDefaultStockCardTemplate();
// then:
assertThat(template.getStockCardFields().size(), is(4));
assertThat(template.getStockCardLineItemFields().size(), is(5));
assertThat(template.getStockCardFields().get(0).getName(), is("packSize"));
assertThat(template.getStockCardLineItemFields().get(0).getName(), is("documentNumber"));
}
use of org.openlmis.stockmanagement.dto.StockCardTemplateDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardTemplateServiceTest method shouldNotSaveTemplateWithUnavailableField.
@Test(expected = ValidationMessageException.class)
public void shouldNotSaveTemplateWithUnavailableField() {
// given
StockCardTemplateDto templateDto = createTemplateDto();
templateDto.getStockCardFields().add(new StockCardFieldDto("i do not exist", false, 1));
// when
stockCardTemplateService.saveOrUpdate(templateDto);
}
use of org.openlmis.stockmanagement.dto.StockCardTemplateDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardTemplateServiceTest method shouldNotSaveTemplateWithNonExistingProgramAndFacilityType.
@Test(expected = ValidationMessageException.class)
public void shouldNotSaveTemplateWithNonExistingProgramAndFacilityType() {
// given: program and facility can not be found in ref data service
doThrow(new ValidationMessageException("errorKey")).when(programFacilityTypeExistenceService).checkProgramAndFacilityTypeExist(any(UUID.class), any(UUID.class));
StockCardTemplateDto templateDto = createTemplateDto();
// when
stockCardTemplateService.saveOrUpdate(templateDto);
}
use of org.openlmis.stockmanagement.dto.StockCardTemplateDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardTemplateServiceTest method shouldThrowValidationExceptionWhenProgramIdMissing.
@Test(expected = ValidationMessageException.class)
public void shouldThrowValidationExceptionWhenProgramIdMissing() throws Exception {
StockCardTemplateDto templateDto = createTemplateDto();
templateDto.setProgramId(null);
// when
stockCardTemplateService.saveOrUpdate(templateDto);
}
use of org.openlmis.stockmanagement.dto.StockCardTemplateDto in project openlmis-stockmanagement by OpenLMIS.
the class StockCardTemplateServiceTest method shouldThrowValidationExceptionWhenFacilityTypeIdMissing.
@Test(expected = ValidationMessageException.class)
public void shouldThrowValidationExceptionWhenFacilityTypeIdMissing() throws Exception {
StockCardTemplateDto templateDto = createTemplateDto();
templateDto.setFacilityTypeId(null);
// when
stockCardTemplateService.saveOrUpdate(templateDto);
}
Aggregations