Class Assertions

  • All Implemented Interfaces:

    public class Assertions
    extends Object
    implements InstanceOfAssertFactories
    The entry point for all Guava assertions.
    marcelfalliere, miralak, Kornel, Jan Gorman, Joel Costigliola, Marcin KwaczyƄski, Max Daniline, Ilya Koshaleu
    • Constructor Detail

      • Assertions

        protected Assertions()
        protected to avoid direct instantiation but allowing subclassing.
    • Method Detail

      • assertThat

        public static ByteSourceAssert assertThat​( actual)
      • assertThat

        public static <K,​V> MultimapAssert<K,​V> assertThat​(<K,​V> actual)
      • assertThat

        public static <T> OptionalAssert<T> assertThat​(<T> actual)
      • assertThat

        public static <T extends Comparable<T>> RangeAssert<T> assertThat​(<T> actual)
      • assertThat

        public static <K extends Comparable<K>,​V> RangeMapAssert<K,​V> assertThat​(<K,​V> actual)
      • assertThat

        public static <T extends Comparable<T>> RangeSetAssert<T> assertThat​(<T> actual)
      • assertThat

        public static <R,​C,​V> TableAssert<R,​C,​V> assertThat​(<R,​C,​V> actual)
      • assertThat

        public static <T> MultisetAssert<T> assertThat​(<T> actual)
      • entry

        public static <K,​V><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).

        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")); 
        Type Parameters:
        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.
        the built entry