Rework requisition service, utils, validate and web tests to use the data builder pattern

Description

This ticket was created based on one of the incomplete 3.5 code freeze tasks.

Acceptance Criteria:

  1. The tests in the requisition component should follow the data builder pattern

  2. The changes should be committed in the packages: service, utils, validate and web

Activity

Klaudia Pałkowska 
May 24, 2019 at 9:31 AM

Never mind, I didn’t have the last changes \:)

Klaudia Pałkowska 
May 24, 2019 at 7:50 AM

I found two places where we are still not using builders:
RequisitionServiceTest

  • line 1320 - new StatusChange

  • line 1450 - new Requisition

Other than that, everything looks good.

Paweł Cieszko 
May 22, 2019 at 12:02 PM
(edited)

Ad. 1 Such construction is used for passing a type (in this case an array type)

Ad. 11 (RequisitionTemplateDto) We use it to build a Dto

Klaudia Pałkowska 
May 17, 2019 at 12:02 PM

I found the following pieces of code which are not following the data builder pattern:

  1. RightReferenceDataServiceTest

  • line 75 new RightDto[0]

2. ConvertToOrderNotifierTest

  • line 98 - new ProgramDto

  • line 99 - new ProcessingPeriodDto

3. JasperReportsViewServiceTest

  • line 428 - new FacilityDto

  • line 444 - new MinimalFacilityDto

  • line 473 - new DefaultRequisitionSearchParams

  • line 492 - new Requisition

4. JasperTemplateServiceTest

  • lines 147, 183, 238, 299 - new JasperTemplate

  • lines 333, 348, 352, 375, 379, 383, 387 - new JasperTemplateParameter

5. PeriodServiceTest

  • line 149 - new Requisition

6. RequisitionServiceTest

  • lines 1076, 1138 - new DefaultRequisitionSearchParams

  • line 1305 - new StatusChange

  • line 1438 - new Requisition

  • line 1452 new ReleasableRequisitionDto

  • line 1572 - new FacilityDto

  • line 1574 - new ProgramDto

7. RequisitionStatusNotifierTest

  • mockServices method

8. RoleAssignmentPermissionValidatorTest

  • new RoleAssignmentDto in every test

9. StatusChangeHelperTest

  • lines 43-48 - new StatusChangeDto

10. StockEventBuilderTest

  • lines 160, 218 - new RequisitionTemplate

  • lines 245-280 - new StockEventAdjustmentDto

  • line 446, 470 - StockCardDto.builder

11. RequisitionTemplateDtoValidatorTest

  • line 708 - new RequisitionTemplateDto

  • line 726 - new FacilityTypeDto

12. ReportingRateDtoBuilderTest

  • line 124 - new GeographicZoneDto

13. RequisitionControllerTest

  • line 270 - new BasicRequisitionDto

  • line 499, 521, 558, 599 - new FacilityDto

  • line 500, 522, 559, 600, 634, 676 - new ProgramDto

  • line 501, 523, 560, 601 - new ProcessingPeriodDto

  • line 648, 690 - new RequisitionDto

  • line 963 - new ReleasableRequisitionDto

  • line 1161, 1171, 1185, 1202 - new Requisition

14. RequisitionDtoBuilderTest

  • line 239 - new Requisition

  • line 243 - new RequisitionTemplate

Moreover, I’m not sure about using DtoGenerator.of (_‌probably we should replace all occurrences with *.buildAsDto?) and _new RightAssignmentPermissionValidationDetails (shouldn’t we add a builder for this class?).

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Story Points

Original estimate

Time tracking

3d logged1h remaining

Sprint

Fix versions

Priority

Time Assistant

Created May 8, 2019 at 1:39 PM
Updated May 29, 2019 at 10:58 AM
Resolved May 29, 2019 at 10:58 AM