Refactor OpenAiImageOptions and enhance test coverage
This commit makes several improvements to the OpenAiImageOptions class:
1. Remove all deprecated methods from OpenAiImageOptions.Builder:
- Removed withN(), withModel(), withQuality(), withResponseFormat(),
withWidth(), withHeight(), withStyle(), and withUser() methods
- These were marked as @Deprecated(forRemoval = true, since = "1.0.0-M8")
2. Align OpenAiImageOptions structure with OpenAiChatOptions:
- Added fromOptions() static method for creating copies
- Added copy() instance method
- Updated Builder class to match pattern in OpenAiChatOptions
- Changed Builder field from private final to protected
- Added Builder constructor that takes an existing options object
3. Enhance setSize() method to maintain consistency:
- Updated setSize() to parse the size string and update width/height properties
- Added proper error handling for invalid formats
- Ensures consistent state between size, width, and height properties
4. Comprehensive test coverage improvements:
- Added tests for builder pattern with all fields
- Added tests for copy functionality
- Added tests for all setter methods
- Added tests for default values
- Added tests for equals(), hashCode(), and toString() methods
- Added specific tests for the updated setSize() behavior
- Fixed test expectations to match actual implementation behavior
These changes improve code consistency, maintainability, and test coverage
while removing deprecated methods that were scheduled for removal.
Signed-off-by: jonghoonpark <dev@jonghoonpark.com>
This commit is contained in:
committed by
Mark Pollack
parent
a2975a6cec
commit
9ca3a7d15f
@@ -35,6 +35,12 @@ Hopefully Watson will reappear in a future version of Spring AI
|
||||
|
||||
|
||||
|
||||
|
||||
[[upgrading-to-1-0-0-RC1]]
|
||||
== Upgrading to 1.0.0-RC1
|
||||
|
||||
|
||||
|
||||
[[upgrading-to-1-0-0-m8]]
|
||||
== Upgrading to 1.0.0-M8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user