Skip to content

Commit

Permalink
Describe a bit the parameterized tests
Browse files Browse the repository at this point in the history
Signed-off-by: Florent MILLOT <millotflo@gmail.com>
  • Loading branch information
flomillot committed Oct 18, 2023
1 parent 585db89 commit 39aaf3e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void tearDown() {
shortCircuitAnalysisResultRepository.deleteAll();
}

@ParameterizedTest
@ParameterizedTest(name = "[{index}] Using the filter(s) {0} should return the given entities")
@MethodSource({
"provideContainsFilters",
"provideStartsWithFilters",
Expand All @@ -80,19 +80,19 @@ void tearDown() {
void feederResultFilterTest(List<ResourceFilter> resourceFilters, List<FeederResultEntity> feederList) {
Specification<FeederResultEntity> specification = FeederResultSpecifications.buildSpecification(RESULT_UUID, resourceFilters);
Page<FeederResultEntity> feederPage = shortCircuitAnalysisResultRepository.findFeederResultsPage(specification, Pageable.unpaged());
assertThat(feederPage.getContent()).extracting("feederResultUuid")
assertThat(feederPage.getContent()).extracting("feederResultUuid").describedAs("Check if the IDs of the feeder page are correct")
.containsExactlyElementsOf(feederList.stream().map(FeederResultEntity::getFeederResultUuid).toList());
}

@ParameterizedTest
@ParameterizedTest(name = "[{index}] Using the pageable {0} should return the given entities")
@MethodSource({
"providePageable",
"provideSortingPageable"
})
void feederResultPageableTest(Pageable pageable, List<FeederResultEntity> feederList) {
Specification<FeederResultEntity> specification = FeederResultSpecifications.buildSpecification(RESULT_UUID, null);
Page<FeederResultEntity> feederPage = shortCircuitAnalysisResultRepository.findFeederResultsPage(specification, pageable);
assertThat(feederPage.getContent()).extracting("feederResultUuid")
assertThat(feederPage.getContent()).extracting("feederResultUuid").describedAs("Check if the IDs of the feeder page are correct")
.containsExactlyElementsOf(feederList.stream().map(FeederResultEntity::getFeederResultUuid).toList());
}

Expand Down

0 comments on commit 39aaf3e

Please sign in to comment.