本文整理了Java中org.apache.commons.lang3.Validate.notNaN()
方法的一些代码示例,展示了Validate.notNaN()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.notNaN()
方法的具体详情如下:
包路径:org.apache.commons.lang3.Validate
类名称:Validate
方法名:notNaN
[英]Validates that the specified argument is not NaN; otherwise throwing an exception.
Validate.notNaN(myDouble);
The message of the exception is "The validated value is not a number".
[中]验证指定的参数不是NaN;否则将引发异常。
Validate.notNaN(myDouble);
异常消息是“验证值不是数字”。
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>Validates that the specified argument is not {@code NaN}; otherwise
* throwing an exception.</p>
*
* <pre>Validate.notNaN(myDouble);</pre>
*
* <p>The message of the exception is "The validated value is not a
* number".</p>
*
* @param value the value to validate
* @throws IllegalArgumentException if the value is not a number
* @see #notNaN(double, java.lang.String, java.lang.Object...)
*
* @since 3.5
*/
public static void notNaN(final double value) {
notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testNotNaN2() {
Validate.notNaN(0.0, "MSG");
Validate.notNaN(Double.POSITIVE_INFINITY, "MSG");
Validate.notNaN(Double.NEGATIVE_INFINITY, "MSG");
try {
Validate.notNaN(Double.NaN, "MSG");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException ex) {
assertEquals("MSG", ex.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testNotNaN1() {
Validate.notNaN(0.0);
Validate.notNaN(Double.POSITIVE_INFINITY);
Validate.notNaN(Double.NEGATIVE_INFINITY);
try {
Validate.notNaN(Double.NaN);
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException ex) {
assertEquals("The validated value is not a number", ex.getMessage());
}
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* <p>Validates that the specified argument is not {@code NaN}; otherwise
* throwing an exception.</p>
*
* <pre>Validate.notNaN(myDouble);</pre>
*
* <p>The message of the exception is "The validated value is not a
* number".</p>
*
* @param value the value to validate
* @throws IllegalArgumentException if the value is not a number
* @see #notNaN(double, java.lang.String, java.lang.Object...)
*
* @since 3.5
*/
public static void notNaN(final double value) {
notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3
/**
* <p>Validates that the specified argument is not {@code NaN}; otherwise
* throwing an exception.</p>
*
* <pre>Validate.notNaN(myDouble);</pre>
*
* <p>The message of the exception is "The validated value is not a
* number".</p>
*
* @param value the value to validate
* @throws IllegalArgumentException if the value is not a number
* @see #notNaN(double, java.lang.String, java.lang.Object...)
*
* @since 3.5
*/
public static void notNaN(final double value) {
notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* <p>Validates that the specified argument is not {@code NaN}; otherwise
* throwing an exception.</p>
*
* <pre>Validate.notNaN(myDouble);</pre>
*
* <p>The message of the exception is "The validated value is not a
* number".</p>
*
* @param value the value to validate
* @throws IllegalArgumentException if the value is not a number
* @see #notNaN(double, java.lang.String, java.lang.Object...)
*
* @since 3.5
*/
public static void notNaN(final double value) {
notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
}
内容来源于网络,如有侵权,请联系作者删除!