citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
445 stars 135 forks source link

Resources.UrlResource#exists returns false if file is empty #1100

Closed tschlat closed 5 months ago

tschlat commented 5 months ago

Citrus Version 4.x

The UrlResource#exists method in Citrus is not behaving as expected when handling file URLs. Specifically, when dealing with file URLs that point to an existing but empty file, the method does not return true as anticipated.

Expected behavior When using the UrlResource#exists method with a file URL, and the file exists (even if it is empty), it should return true.

Actual behavior Currently, the UrlResource#exists method does not return true for file URLs pointing to empty files.

Test case sample The current implementation tests the content length of the file, and if the file is empty (i.e., content length is 0), it does not consider it as existing. However, for file URLs, the existence of the file should be determined solely by whether the file itself exists on the file system, regardless of its content length.