Skip to content

Commit

Permalink
feat: Added logic for handling unavailable images
Browse files Browse the repository at this point in the history
Refs: #307
  • Loading branch information
pbezliapovich committed Dec 19, 2024
1 parent 32ce943 commit cd69c6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public int getUnavailableWorkItemAttachmentsCount() {
public List<String> getWorkItemsIdContainUnavailableAttachments() {
return unavailableWorkItemAttachments.stream()
.distinct()
.collect(Collectors.toList());
.toList();
}

public @NotNull DocumentType getDocumentType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ void getResourceAsBytesExceptionHandling() {
assertTrue(unavailableAttachments.isEmpty());
}

@Test
void getWorkItemIdFromAttachmentUrlValidUrl() {
String url = "http://localhost/polarion/wi-attachment/elibrary/EL-14852/attachment.png";
String result = resourceProvider.getWorkItemIdFromAttachmentUrl(url);
assertEquals("EL-14852", result);
}

@Test
void getWorkItemIdFromAttachmentUrl_InvalidUrl() {
String url = "http://example.com/invalid/url";
String result = resourceProvider.getWorkItemIdFromAttachmentUrl(url);
assertNull(result);
}

@Test
void isMediaTypeMismatchMatchingMimeTypes() {
String resource = "image.png";
Expand Down

0 comments on commit cd69c6d

Please sign in to comment.