Implement a utility class Comparables that includes a static method leastMagnitude capable of determining the least magnitude value between three parameters (min, max, and zero). The method should account for edge cases such as null values and adhere to the rules established in the original implementation.
Input/Output Requirements:
Input:
Three parameters of type T, where T extends Comparable<? super T>:
min: The minimum value (can be null).
max: The maximum value (can be null).
zero: A reference value against which min and max are compared (cannot be null).
Output:
The method should return a value of type T, which is the least magnitude value among min, max, and zero based on the conditions defined in the existing implementation.
Implementation Instructions:
Create the Comparables class in the directory /app/.
Ensure the method leastMagnitude is implemented as per the provided signature and logic.
Include appropriate null checks and comparisons to handle all edge cases as outlined in the original function.
Write unit tests to verify the functionality of the leastMagnitude method.
File Structure:
Place the Comparables class in /app/Comparables.java.