ValidationUtils { public static boolean areNaN(ValidationConfig config, float... values) { Objects.requireNonNull(config); if (config.areOkMissingValues()) { return false; } boolean areNaN = false; for (float value : values) { if (Float.isNaN(value)) { areNaN = true; break; } } return areNaN; } private  ValidationUtils(); static ValidationWriter createValidationWriter(String id, ValidationConfig config, Writer writer, ValidationType validationType); static boolean areNaN(ValidationConfig config, float... values); static boolean areNaN(ValidationConfig config, double... values); static boolean boundedWithin(double lowerBound, double upperBound, double value, double margin); static boolean isMainComponent(ValidationConfig config, boolean mainComponent); static final String VALIDATION_ERROR; static final String VALIDATION_WARNING; }
@Test public void areNaN() { assertFalse(ValidationUtils.areNaN(looseConfig, 1.02f)); assertFalse(ValidationUtils.areNaN(looseConfig, 1f, 3.5f)); assertFalse(ValidationUtils.areNaN(looseConfig, 3.7f, 2f, .004f)); assertTrue(ValidationUtils.areNaN(looseConfig, Float.NaN)); assertTrue(ValidationUtils.areNaN(looseConfig, Float.NaN, 2f, .004f)); assertTrue(ValidationUtils.areNaN(looseConfig, Float.NaN, 2f, Float.NaN)); assertFalse(ValidationUtils.areNaN(looseConfig, 1.02d)); assertFalse(ValidationUtils.areNaN(looseConfig, 1d, 3.5d)); assertFalse(ValidationUtils.areNaN(looseConfig, 3.7d, 2d, .004d)); assertTrue(ValidationUtils.areNaN(looseConfig, Double.NaN)); assertTrue(ValidationUtils.areNaN(looseConfig, Double.NaN, 2d, .004d)); assertTrue(ValidationUtils.areNaN(looseConfig, Double.NaN, 2d, Double.NaN)); looseConfig.setOkMissingValues(true); assertFalse(ValidationUtils.areNaN(looseConfig, 3.7f, 2f, .004f)); assertFalse(ValidationUtils.areNaN(looseConfig, Float.NaN)); assertFalse(ValidationUtils.areNaN(looseConfig, Float.NaN, 2f, .004f)); assertFalse(ValidationUtils.areNaN(looseConfig, Float.NaN, 2f, Float.NaN)); assertFalse(ValidationUtils.areNaN(looseConfig, 3.7d, 2d, .004d)); assertFalse(ValidationUtils.areNaN(looseConfig, Double.NaN)); assertFalse(ValidationUtils.areNaN(looseConfig, Double.NaN, 2d, .004d)); assertFalse(ValidationUtils.areNaN(looseConfig, Double.NaN, 2d, Double.NaN)); }