Skip to content

Commit

Permalink
Fix master build (#599)
Browse files Browse the repository at this point in the history
* Fixing mutation tests

* Fixing sonar issues
  • Loading branch information
SabinaHMCTS authored Dec 4, 2024
1 parent dc77383 commit 327c334
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public static ListOfValueDto createListOfCategoriesDtoMock(String categoryId, St
}

public static ListOfValueDto createListOfCategoriesDtoWithExternalReferenceMock(String categoryId, String serviceId,
String parentCategory, String parentKey, String key,
Long lovOrder) {
String parentCategory, String parentKey, String key) {
CategoryKey categoryKey = new CategoryKey();
categoryKey.setCategoryKey(categoryId);
categoryKey.setKey(key);
Expand All @@ -45,7 +44,7 @@ public static ListOfValueDto createListOfCategoriesDtoWithExternalReferenceMock(
listOfValueDtoMock.setParentCategory(parentCategory);
listOfValueDtoMock.setParentKey(parentKey);
listOfValueDtoMock.setValueEn("Judicial office holder");
listOfValueDtoMock.setLovOrder(lovOrder);
listOfValueDtoMock.setLovOrder(null);
listOfValueDtoMock.setExternalReferenceType("74");
listOfValueDtoMock.setExternalReference("JudicialRole");
return listOfValueDtoMock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,35 @@ void retrieveCategoriesByCategoryId() {
assertNull(actualCategory.getChildNodes());
}

@Test
void retrieveCategoriesByAllExternalReference() {
List<ListOfValueDto> listOfValueDtos = new ArrayList<>();
listOfValueDtos.add(CrdTestSupport.createListOfCategoriesDtoWithExternalReferenceMock("panelCategoryMember",
"BBA3","panelCategory",
"BBA3-panelCategory-001",
"BBA3-panelCategory-001-74"));
doReturn(listOfValueDtos).when(listOfValuesRepository)
.findAll(ArgumentMatchers.<Specification<ListOfValueDto>>any());

CategoryRequest request = CategoryRequest.builder()
.categoryId("panelCategoryMember")
.externalReference("JudicialRole")
.externalReferenceType("74")
.build();

List<Category> result = crdServiceImpl.retrieveListOfValuesByCategory(request);

assertNotNull(result);
assertEquals(listOfValueDtos.get(0).getCategoryKey().getKey(), result.get(0).getKey());
assertEquals(listOfValueDtos.get(0).getCategoryKey().getCategoryKey(), result.get(0).getCategoryKey());
assertEquals(listOfValueDtos.get(0).getExternalReference(), result.get(0).getExternalReference());
assertEquals(listOfValueDtos.get(0).getExternalReferenceType(), result.get(0).getExternalReferenceType());
}

@Test
void retrieveCategoriesWithExternalReferenceByCategoryId() {
List<ListOfValueDto> listOfValueDtos = new ArrayList<>();
listOfValueDtos.add(CrdTestSupport.createListOfCategoriesDtoMock("panelCategoryMember",
listOfValueDtos.add(CrdTestSupport.createListOfCategoriesDtoWithExternalReferenceMock("panelCategoryMember",
"BBA3","panelCategory",
"BBA3-panelCategory-001",
"BBA3-panelCategory-001-74"));
Expand Down Expand Up @@ -124,6 +149,7 @@ void retrieveCategoriesByAllParams() {




@NotNull
private List<ListOfValueDto> buildListOfValuesDtos() {
List<ListOfValueDto> listOfValueDtos = new ArrayList<>();
Expand Down

0 comments on commit 327c334

Please sign in to comment.