Skip to content

#1060 Implement delete promotion and add some UTs (#1065) #739

#1060 Implement delete promotion and add some UTs (#1065)

#1060 Implement delete promotion and add some UTs (#1065) #739

GitHub Actions / Promotion-Service-Unit-Test-Results succeeded Sep 24, 2024 in 0s

35 passed, 0 failed and 0 skipped

Tests passed successfully

Report Passed Failed Skipped Time
promotion/target/failsafe-reports/TEST-com.yas.promotion.service.PromotionServiceIT.xml 8✅ 56s
promotion/target/surefire-reports/TEST-com.yas.promotion.controller.PromotionControllerTest.xml 10✅ 6s
promotion/target/surefire-reports/TEST-com.yas.promotion.service.ProductServiceTest.xml 3✅ 735ms
promotion/target/surefire-reports/TEST-com.yas.promotion.service.PromotionServiceTest.xml 6✅ 10s
promotion/target/surefire-reports/TEST-com.yas.promotion.validation.PromotionValidatorTest.xml 8✅ 1s

✅ promotion/target/failsafe-reports/TEST-com.yas.promotion.service.PromotionServiceIT.xml

8 tests were completed in 56s with 8 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.yas.promotion.service.PromotionServiceIT 8✅ 56s

✅ com.yas.promotion.service.PromotionServiceIT

✅ testUpdatePromotion_whenPromotionIsEmpty_throwNotFoundException
✅ createPromotion_ThenSuccess
✅ createPromotion_WhenExistedSlug_ThenDuplicatedExceptionThrown
✅ testUpdatePromotion_whenNormalCase_updatePromotion
✅ testDeletePromotion_normalCase_deletePromotion
✅ testDeletePromotion_existsPromotionUsageByPromotionId_throwBadRequestException
✅ getPromotionLists_existsPromotions_ThenPromotionListVm
✅ createPromotion_WhenEndDateBeforeStartDate_ThenDateRangeExceptionThrown

✅ promotion/target/surefire-reports/TEST-com.yas.promotion.controller.PromotionControllerTest.xml

10 tests were completed in 6s with 10 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.yas.promotion.controller.PromotionControllerTest 10✅ 6s

✅ com.yas.promotion.controller.PromotionControllerTest

✅ testDeletePromotion_whenValidRequest_deleteSuccess
✅ testCreatePromotion_whenNameIsOverMaxLength_thenReturnBadRequest
✅ testUpdatePromotion_whenValidRequest_thenReturnPromotionDetailVm
✅ testCreatePromotion_whenNameIsBlank_thenReturnBadRequest
✅ testCreatePromotion_whenDiscountPercentageIsGreaterThanHundred_thenReturnBadRequest
✅ test_getPromotion_success
✅ testCreatePromotion_whenDiscountPercentageIsSmallerThanZero_thenReturnBadRequest
✅ testListPromotions_whenValidRequest_thenReturnPromotionListVm
✅ testCreatePromotion_whenDiscountAmountIsSmallerThanZero_thenReturnBadRequest
✅ testCreatePromotion_whenRequestIsValid_thenReturnOk

✅ promotion/target/surefire-reports/TEST-com.yas.promotion.service.ProductServiceTest.xml

3 tests were completed in 735ms with 3 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.yas.promotion.service.ProductServiceTest 3✅ 735ms

✅ com.yas.promotion.service.ProductServiceTest

✅ testGetProductByIds_ifNormalCase_returnProductVms
✅ testGetBrandByIds_ifNormalCase_returnBrandVms
✅ testGetCategoryByIds_ifNormalCase_returnCategoryGetVms

✅ promotion/target/surefire-reports/TEST-com.yas.promotion.service.PromotionServiceTest.xml

6 tests were completed in 10s with 6 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.yas.promotion.service.PromotionServiceTest 6✅ 10s

✅ com.yas.promotion.service.PromotionServiceTest

✅ getPromotion_WhenNotExist_ThenNotFoundExceptionThrown
✅ createPromotion_ThenSuccess
✅ createPromotion_WhenExistedSlug_ThenDuplicatedExceptionThrown
✅ getPromotion_ThenSuccess
✅ getPromotionList_ThenSuccess
✅ createPromotion_WhenEndDateBeforeStartDate_ThenDateRangeExceptionThrown

✅ promotion/target/surefire-reports/TEST-com.yas.promotion.validation.PromotionValidatorTest.xml

8 tests were completed in 1s with 8 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
com.yas.promotion.validation.PromotionValidatorTest 8✅ 1s

✅ com.yas.promotion.validation.PromotionValidatorTest

✅ testIsValid_whenUsageLimitIs0_isValidFalse
✅ testIsValid_whenApplyToIsProductAndProductIdsIdEmpty_isValidFalse
✅ testIsValid_whenAppleToCategory_isValidTrue
✅ testIsValid_whenDiscountTypeIsFixedAndDiscountAmountIs0_isValidFalse
✅ testIsValid_whenApplyToIsCategoryAndCategoryIdsIdEmpty_isValidFalse
✅ testIsValid_whenAppleToBrand_isValidTrue
✅ testIsValid_whenApplyToIsBrandAndBrandIdsIdEmpty_isValidFalse
✅ testIsValid_whenAppleToProduct_isValidTrue