Bhavesh9908 opened a new pull request, #1294: URL: https://github.com/apache/commons-lang/pull/1294
This PR improves the ArrayFillTest class in the org.apache.commons.lang3 package by addressing null safety, adding edge case coverage, and refactoring redundant test code for better readability and maintainability. Changes: Refactor Using @ParameterizedTest: Combined similar test cases into a single parameterized test method using @ParameterizedTest and @MethodSource, reducing redundancy in tests for different data types (e.g., byte[], char[], double[], String[]). Null Safety Enhancements: Updated tests for null arrays to explicitly check that ArrayFill.fill() returns null when a null array is passed. Example: testFillByteArrayNull, testFillCharArrayNull, etc., now include assertions to verify null handling. Improved Readability: Replaced numeric literals for char arrays with more readable character literals (e.g., 'A' instead of 1) in testFillCharArray. Edge Case Coverage: Added new test cases for: Empty Arrays: Verifying behavior when filling an empty array. Arrays with Default Values: Ensuring ArrayFill.fill() correctly handles arrays already populated with default values. Object Arrays with null Values: Added a test to ensure ArrayFill.fill() can handle filling object arrays with null values. New Test Methods: testFillEmptyArray: Ensures the method works correctly for empty arrays. testFillObjectArrayWithNull: Tests behavior when filling an object array with null values. testFillArrayWithDefaultValues: Verifies behavior when arrays already have default values. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
