Skip to content

Commit

Permalink
Merge pull request #693 from hmcts/RDCC-6526
Browse files Browse the repository at this point in the history
  • Loading branch information
ishratt authored Apr 4, 2023
2 parents 8eafc62 + a4a16f2 commit d16c580
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;

Expand Down Expand Up @@ -305,7 +306,7 @@ CaseWorkerProfile buildCaseWorkerProfile() {
caseWorkerProfile.setCreatedDate(LocalDateTime.now());
caseWorkerProfile.setLastUpdate(LocalDateTime.now());

caseWorkerProfile.setCaseWorkerId("27fbd198-552e-4c32-9caf-37be1545caaf");
caseWorkerProfile.setCaseWorkerId("CWID1");
caseWorkerProfile.setCaseWorkerRoles(singletonList(caseWorkerRole));
caseWorkerProfile.setCaseWorkerLocations(singletonList(caseWorkerLocation));
CaseWorkerSkill caseWorkerSkill = getCaseWorkerSkill();
Expand Down Expand Up @@ -586,6 +587,24 @@ private StaffProfileCreationRequest getStaffProfileUpdateRequest() {
.skills(singletonList(skillsRequest))
.build();
}

@State({"A staff profile by caseworker id"})
public void fetchStaffProfileById() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();

UserProfileResponse userProfileResponse = new UserProfileResponse();
userProfileResponse.setIdamId("12345678");
userProfileResponse.setIdamStatus(STATUS_ACTIVE);
String body = mapper.writeValueAsString(List.of(userProfileResponse));

when(userProfileFeignClient.getUserProfile(any()))
.thenReturn(Response.builder()
.request(mock(Request.class)).body(body, defaultCharset()).status(200).build());

CaseWorkerProfile caseWorkerProfile = buildCaseWorkerProfile();

doReturn(Optional.of(caseWorkerProfile)).when(caseWorkerProfileRepo).findByCaseWorkerId(anyString());
}
}


0 comments on commit d16c580

Please sign in to comment.