Skip to content

Commit

Permalink
Fix get contract
Browse files Browse the repository at this point in the history
  • Loading branch information
pierpaolodidato89 authored Dec 20, 2024
1 parent 51a43f2 commit 29c5794
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Function;
Expand Down Expand Up @@ -423,7 +422,7 @@ public File retrieveAttachment(OnboardingAttachment onboardingAttachment, String

@Override
public Optional<File> getLogoFile() {
if (Objects.nonNull(isLogoEnable) && isLogoEnable) {
if (Boolean.TRUE.equals(isLogoEnable)) {

StringBuilder stringBuilder =
new StringBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public Uni<List<Token>> getToken(String onboardingId) {
}
@Override
public Uni<RestResponse<File>> retrieveContractNotSigned(String onboardingId) {
return Token.find("onboardingId = ?1 and type = ?2", onboardingId, INSTITUTION.name())
.firstResult()
return Token.findById(onboardingId)
.map(Token.class::cast)
.onItem().transformToUni(token ->
Uni.createFrom().item(() -> azureBlobClient.getFileAsPdf(String.format("%s%s/%s", onboardingMsConfig.getContractPath(), onboardingId, token.getContractFilename())))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ void retrieveContractNotSigned() {
token.setContractFilename("fileName");
token.setType(TokenType.INSTITUTION);
ReactivePanacheQuery queryPage = mock(ReactivePanacheQuery.class);
when(queryPage.firstResult()).thenReturn(Uni.createFrom().item(token));

PanacheMock.mock(Token.class);
when(Token.find("onboardingId = ?1 and type = ?2", onboardingId, INSTITUTION.name()))
.thenReturn(queryPage);
when(Token.findById(onboardingId))
.thenReturn(Uni.createFrom().item(token));

when(azureBlobClient.getFileAsPdf(anyString())).thenReturn(new File("fileName"));

Expand Down

0 comments on commit 29c5794

Please sign in to comment.