(Precision precision, BigDecimal fraction)
| 2947 | } |
| 2948 | |
| 2949 | private static Precision checkFraction(Precision precision, BigDecimal fraction) |
| 2950 | { |
| 2951 | if (precision.includes(Precision.SECOND)) { |
| 2952 | if (fraction != null && (fraction.signum() == -1 || BigDecimal.ONE.compareTo(fraction) != 1)) { |
| 2953 | throw new IllegalArgumentException(String.format("Fractional seconds %s must be greater than or equal to 0 and less than 1", fraction)); |
| 2954 | } |
| 2955 | } |
| 2956 | else { |
| 2957 | if (fraction != null) { |
| 2958 | throw new IllegalArgumentException("Fraction must be null for non-second precision: " + fraction); |
| 2959 | } |
| 2960 | } |
| 2961 | |
| 2962 | return precision; |
| 2963 | } |
| 2964 | } |
no test coverage detected