Stirling-PDF/src/test/java/stirling/software/SPDF/utils
Ludy 2ab951e080
Improve Type-Safe Casting with Pattern Matching (#2990)
# Description of Changes

Please provide a summary of the changes, including:

This PR refactors multiple instances of type casting throughout the
codebase by replacing them with Java's pattern matching for
`instanceof`. This approach eliminates redundant type casting, improves
code readability, and reduces the chances of `ClassCastException`. The
changes primarily affect authentication handling, PDF processing, and
certificate validation.

### Key Changes:
- Replaced traditional `instanceof` checks followed by explicit casting
with pattern matching.
- Improved readability and maintainability of type-related operations.
- Applied changes across security modules, PDF utilities, and image
processing functions.

This refactor does not introduce new functionality but enhances the
robustness and clarity of the existing code.

pending until #2818 is published

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
2025-02-25 21:31:50 +00:00
..
validation Improve Type-Safe Casting with Pattern Matching (#2990) 2025-02-25 21:31:50 +00:00
ErrorUtilsTest.java Add junit tests for utils classes 2024-06-06 12:54:12 +03:00
FileToPdfTest.java Dynamic paths for tools and removal of unused book endpoints (#3018) 2025-02-23 13:36:21 +00:00
GeneralUtilsTest.java Enhancement: Enhance NFunction evaluation and support advanced NFunctions (#2577) 2025-01-02 14:48:20 +00:00
ImageProcessingUtilsTest.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
PdfUtilsTest.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
ProcessExecutorTest.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
PropertyConfigsTest.java Add junit tests for utils classes 2024-06-06 12:54:12 +03:00
RequestUriUtilsTest.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00
UrlUtilsTest.java Add junit tests for utils classes 2024-06-06 12:54:12 +03:00
WebResponseUtilsTest.java formattingand autowired constructors (#2557) 2024-12-24 09:52:53 +00:00