本文整理了Java中java.lang.IllegalArgumentException.getMessage()
方法的一些代码示例,展示了IllegalArgumentException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalArgumentException.getMessage()
方法的具体详情如下:
包路径:java.lang.IllegalArgumentException
类名称:IllegalArgumentException
方法名:getMessage
暂无
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void mappingBadCapacityHint() throws Exception {
Observable<Integer> source = Observable.just(1);
try {
Observable.just(source, source, source).concatMapEager((Function)Functions.identity(), 10, -99);
} catch (IllegalArgumentException ex) {
assertEquals("prefetch > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void repeatLongPredicateInvalid() {
try {
Observable.just(1).repeat(-99);
fail("Should have thrown");
} catch (IllegalArgumentException ex) {
assertEquals("times >= 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
public void createInvalidCapacity() {
try {
ReplaySubject.create(-99);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("capacityHint > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void invalidSpan() {
try {
Observable.just(1).window(-99, 1, TimeUnit.SECONDS);
fail("Should have thrown!");
} catch (IllegalArgumentException ex) {
assertEquals("timespan > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void createWithSizeInvalidCapacity() {
try {
ReplaySubject.createWithSize(-99);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("maxSize > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void negativeCount() {
try {
Flowable.range(1, -1);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("count >= 0 required but it was -1", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void createInvalidCapacity() {
try {
ReplayProcessor.create(-99);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("capacityHint > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void negativeCount() {
try {
Flowable.rangeLong(1L, -1L);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("count >= 0 required but it was -1", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void countNegative() {
try {
Flowable.intervalRange(1, -1, 1, 1, TimeUnit.MILLISECONDS);
fail("Should have thrown!");
} catch (IllegalArgumentException ex) {
assertEquals("count >= 0 required but it was -1", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void createWithSizeInvalidCapacity() {
try {
ReplayProcessor.createWithSize(-99);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("maxSize > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void negativeCount() {
try {
Observable.rangeLong(1L, -1L);
fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("count >= 0 required but it was -1", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings("unchecked")
@Test
public void negativeMaxConcurrent() {
try {
Flowable.merge(Arrays.asList(Flowable.just(1), Flowable.just(2)), -1);
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
assertEquals("maxConcurrency > 0 required but it was -1", e.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void takeNegative() {
try {
Flowable.just(1).take(-99);
fail("Should have thrown");
} catch (IllegalArgumentException ex) {
assertEquals("count >= 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void repeatLongPredicateInvalid() {
try {
Flowable.just(1).repeat(-99);
fail("Should have thrown");
} catch (IllegalArgumentException ex) {
assertEquals("times >= 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void invalidSpan() {
try {
Flowable.just(1).window(-99, 1, TimeUnit.SECONDS);
fail("Should have thrown!");
} catch (IllegalArgumentException ex) {
assertEquals("timespan > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void createWithTimeAndSizeInvalidCapacity() {
try {
ReplaySubject.createWithTimeAndSize(1, TimeUnit.DAYS, Schedulers.computation(), -99);
fail("Didn't throw IllegalArgumentException");
} catch (IllegalArgumentException ex) {
assertEquals("maxSize > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void invalidPrefetch() {
try {
Completable.concat(Flowable.just(Completable.complete()), -99);
fail("Should have thrown IllegalArgumentExceptio");
} catch (IllegalArgumentException ex) {
assertEquals("prefetch > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void longOverflow() {
Observable.intervalRange(Long.MAX_VALUE - 1, 2, 1, 1, TimeUnit.MILLISECONDS);
Observable.intervalRange(Long.MIN_VALUE, Long.MAX_VALUE, 1, 1, TimeUnit.MILLISECONDS);
try {
Observable.intervalRange(Long.MAX_VALUE - 1, 3, 1, 1, TimeUnit.MILLISECONDS);
fail("Should have thrown!");
} catch (IllegalArgumentException ex) {
assertEquals("Overflow! start + count is bigger than Long.MAX_VALUE", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void mappingBadCapacityHint() throws Exception {
Flowable<Integer> source = Flowable.just(1);
try {
Flowable.just(source, source, source).concatMapEager((Function)Functions.identity(), 10, -99);
} catch (IllegalArgumentException ex) {
assertEquals("prefetch > 0 required but it was -99", ex.getMessage());
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void invalidPrefetch() {
try {
Completable.merge(Flowable.just(Completable.complete()), -99);
fail("Should have thrown IllegalArgumentExceptio");
} catch (IllegalArgumentException ex) {
assertEquals("maxConcurrency > 0 required but it was -99", ex.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!