public interface Preconditions
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
assertInstanceOf(Object object,
Class<T> clazz) |
static <T> T |
assertNotNull(T object,
String name) |
static <T> T |
assertNotNull(T object,
String format,
Object... args) |
static <T> T |
assertNotNull(T object,
Supplier<String> message) |
static void |
assertNull(Object object,
String name) |
static void |
assertNull(Object object,
Supplier<String> message) |
static void |
assertSame(long expected,
long computed,
String name) |
static void |
assertSame(Object expected,
Object computed,
String name) |
static void |
assertTrue(boolean value)
Assert if the given value is true.
|
static void |
assertTrue(boolean value,
Object message)
Assert if the given value is true.
|
static void |
assertTrue(boolean value,
String format,
Object... args)
Assert if the given value is true.
|
static void |
assertTrue(boolean value,
Supplier<Object> message)
Assert if the given value is true.
|
static <T> void |
assertUnique(Iterable<T> first) |
static <T> void |
assertUnique(Iterable<T> original,
Iterable<T> toBeAdded) |
static void assertTrue(boolean value)
value - the value to be asserted.IllegalStateException - if the given value is false.static void assertTrue(boolean value,
Object message)
value - the value to be asserted.message - The exception message.IllegalStateException - with the given message if the given value is false.static void assertTrue(boolean value,
String format,
Object... args)
value - the value to be asserted.format - exception message format.args - exception message arguments.IllegalStateException - if the given value is false.
The exception message is constructed by String.format(String, Object...)
with the given format and arguments.static void assertTrue(boolean value,
Supplier<Object> message)
value - the value to be asserted.message - The exception message supplier.IllegalStateException - with the given message if the given value is false.static void assertSame(long expected,
long computed,
String name)
static <T> T assertNotNull(T object,
String name)
static <T> void assertUnique(Iterable<T> first)
Copyright © 2017–2023 The Apache Software Foundation. All rights reserved.