Search in sources :

Example 16 with ValidReasonAssignment

use of org.openlmis.stockmanagement.domain.reason.ValidReasonAssignment in project openlmis-stockmanagement by OpenLMIS.

the class ValidReasonAssignmentDtoBuilderTest method shouldBuildListOfDtosWithProperServiceUrls.

@Test
public void shouldBuildListOfDtosWithProperServiceUrls() {
    ValidReasonAssignment assignment = new ValidReasonAssignmentDataBuilder().build();
    ValidReasonAssignment assignment2 = new ValidReasonAssignmentDataBuilder().withFacilityType(UUID.randomUUID()).withProgram(UUID.randomUUID()).build();
    List<ValidReasonAssignmentDto> dtos = dtoBuilder.build(Lists.newArrayList(assignment, assignment2));
    assertEquals(2, dtos.size());
    assertValidReasonAssignmentDto(assignment, dtos.get(0));
    assertValidReasonAssignmentDto(assignment2, dtos.get(1));
}
Also used : ValidReasonAssignmentDataBuilder(org.openlmis.stockmanagement.testutils.ValidReasonAssignmentDataBuilder) ValidReasonAssignment(org.openlmis.stockmanagement.domain.reason.ValidReasonAssignment) ValidReasonAssignmentDto(org.openlmis.stockmanagement.dto.ValidReasonAssignmentDto) Test(org.junit.Test)

Example 17 with ValidReasonAssignment

use of org.openlmis.stockmanagement.domain.reason.ValidReasonAssignment in project openlmis-stockmanagement by OpenLMIS.

the class ValidReasonAssignmentDataBuilder method build.

/**
 * Creates new instance of {@link ValidReasonAssignment} with properties.
 * @return created valid reason assignment.
 */
public ValidReasonAssignment build() {
    ValidReasonAssignment assignment = new ValidReasonAssignment(programId, facilityTypeId, hidden, reason);
    assignment.setId(id);
    return assignment;
}
Also used : ValidReasonAssignment(org.openlmis.stockmanagement.domain.reason.ValidReasonAssignment)

Aggregations

ValidReasonAssignment (org.openlmis.stockmanagement.domain.reason.ValidReasonAssignment)17 Test (org.junit.Test)12 ValidReasonAssignmentDto (org.openlmis.stockmanagement.dto.ValidReasonAssignmentDto)8 ResultActions (org.springframework.test.web.servlet.ResultActions)7 UUID (java.util.UUID)6 UUID.randomUUID (java.util.UUID.randomUUID)4 StockCardLineItemReason (org.openlmis.stockmanagement.domain.reason.StockCardLineItemReason)4 StockCardLineItemReasonDataBuilder (org.openlmis.stockmanagement.testutils.StockCardLineItemReasonDataBuilder)2 ValidReasonAssignmentDataBuilder (org.openlmis.stockmanagement.testutils.ValidReasonAssignmentDataBuilder)2 Before (org.junit.Before)1 ResponseEntity (org.springframework.http.ResponseEntity)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1