本文整理了Java中org.apache.commons.lang3.Validate.exclusiveBetween()
方法的一些代码示例,展示了Validate.exclusiveBetween()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Validate.exclusiveBetween()
方法的具体详情如下:
包路径:org.apache.commons.lang3.Validate
类名称:Validate
方法名:exclusiveBetween
[英]Validate that the specified primitive value falls between the two exclusive values specified; otherwise, throws an exception.
Validate.exclusiveBetween(0.1, 2.1, 1.1);
[中]验证指定的原语值是否介于指定的两个互斥值之间;否则,抛出一个异常
Validate.exclusiveBetween(0.1, 2.1, 1.1);
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetweenLong() {
Validate.exclusiveBetween(0, 2, 1);
try {
Validate.exclusiveBetween(0, 5, 6);
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 6 is not in the specified exclusive range of 0 to 5", e.getMessage());
}
try {
Validate.exclusiveBetween(0, 5, 5);
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 5 is not in the specified exclusive range of 0 to 5", e.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetweenLong_withMessage() {
Validate.exclusiveBetween(0, 2, 1, "Error");
try {
Validate.exclusiveBetween(0, 5, 6, "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
try {
Validate.exclusiveBetween(0, 5, 5, "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetween() {
Validate.exclusiveBetween("a", "c", "b");
try {
Validate.exclusiveBetween("0", "5", "6");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 6 is not in the specified exclusive range of 0 to 5", e.getMessage());
}
try {
Validate.exclusiveBetween("0", "5", "5");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 5 is not in the specified exclusive range of 0 to 5", e.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetweenDouble_withMessage() {
Validate.exclusiveBetween(0.1, 2.1, 1.1, "Error");
try {
Validate.exclusiveBetween(0.1, 5.1, 6.1, "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
try {
Validate.exclusiveBetween(0.1, 5.1, 5.1, "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetween_withMessage() {
Validate.exclusiveBetween("a", "c", "b", "Error");
try {
Validate.exclusiveBetween("0", "5", "6", "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
try {
Validate.exclusiveBetween("0", "5", "5", "Error");
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("Error", e.getMessage());
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void testExclusiveBetweenDouble() {
Validate.exclusiveBetween(0.1, 2.1, 1.1);
try {
Validate.exclusiveBetween(0.1, 5.1, 6.1);
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 6.1 is not in the specified exclusive range of 0.1 to 5.1", e.getMessage());
}
try {
Validate.exclusiveBetween(0.1, 5.1, 5.1);
fail("Expecting IllegalArgumentException");
} catch (final IllegalArgumentException e) {
assertEquals("The value 5.1 is not in the specified exclusive range of 0.1 to 5.1", e.getMessage());
}
}
代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-file-metadata-util
Validate.notNull(is, "empty input stream");
Validate.notNull(charset, "charset cannot be null");
Validate.exclusiveBetween(1, MAX_ROWS, rows, "invalid number of sample rows");
内容来源于网络,如有侵权,请联系作者删除!