public class Assertions extends Object
Modifier | Constructor and Description |
---|---|
protected |
Assertions()
protected to avoid direct instanciation but allowing subclassing.
|
Modifier and Type | Method and Description |
---|---|
static ByteSourceAssert |
assertThat(com.google.common.io.ByteSource actual) |
static <K,V> MultimapAssert<K,V> |
assertThat(com.google.common.collect.Multimap<K,V> actual) |
static <T> MultisetAssert<T> |
assertThat(com.google.common.collect.Multiset<T> actual) |
static <T> OptionalAssert<T> |
assertThat(com.google.common.base.Optional<T> actual) |
static <T extends Comparable<T>> |
assertThat(com.google.common.collect.Range<T> actual) |
static <K extends Comparable<K>,V> |
assertThat(com.google.common.collect.RangeMap<K,V> actual) |
static <R,C,V> TableAssert<R,C,V> |
assertThat(com.google.common.collect.Table<R,C,V> actual) |
static <K,V> org.assertj.core.data.MapEntry<K,V> |
entry(K key,
V value)
Only delegate to
MapEntry.entry(Object, Object) so that Assertions offers a fully featured entry point to all
AssertJ Guava features (but you can use MapEntry if you prefer). |
protected Assertions()
public static ByteSourceAssert assertThat(com.google.common.io.ByteSource actual)
public static <K,V> MultimapAssert<K,V> assertThat(com.google.common.collect.Multimap<K,V> actual)
public static <T> OptionalAssert<T> assertThat(com.google.common.base.Optional<T> actual)
public static <T extends Comparable<T>> RangeAssert<T> assertThat(com.google.common.collect.Range<T> actual)
public static <K extends Comparable<K>,V> RangeMapAssert<K,V> assertThat(com.google.common.collect.RangeMap<K,V> actual)
public static <R,C,V> TableAssert<R,C,V> assertThat(com.google.common.collect.Table<R,C,V> actual)
public static <T> MultisetAssert<T> assertThat(com.google.common.collect.Multiset<T> actual)
public static <K,V> org.assertj.core.data.MapEntry<K,V> entry(K key, V value)
MapEntry.entry(Object, Object)
so that Assertions offers a fully featured entry point to all
AssertJ Guava features (but you can use MapEntry
if you prefer).
Typical usage is to call entry
in MultimapAssert contains
assertion as shown below :
Multimap<String, String> actual = ArrayListMultimap.create();
actual.putAll("Lakers", newArrayList("Kobe Bryant", "Magic Johnson", "Kareem Abdul Jabbar"));
actual.putAll("Spurs", newArrayList("Tony Parker", "Tim Duncan", "Manu Ginobili"));
assertThat(actual).contains(entry("Lakers", "Kobe Bryant"), entry("Spurs", "Tim Duncan"));
K
- the type of the key of this entry.V
- the type of the value of this entry.key
- the key of the entry to create.value
- the value of the entry to create.Copyright © 2018 AssertJ. All rights reserved.