Class MultimapSubject.UsingCorrespondence<A,​E>

  • Enclosing class:
    MultimapSubject

    public final class MultimapSubject.UsingCorrespondence<A,​E>
    extends java.lang.Object
    A partially specified check in which the actual values (i.e. the values of the Multimap under test) are compared to expected values using a Correspondence. The expected values are of type E. Call methods on this object to actually execute the check.

    Note that keys will always be compared with regular object equality (Object.equals(java.lang.Object)).

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Ordered containsAtLeast​(java.lang.Object k0, E v0, java.lang.Object... rest)
      Fails if the multimap does not contain at least the given key/value pairs.
      Ordered containsAtLeastEntriesIn​(com.google.common.collect.Multimap<?,​? extends E> expectedMultimap)
      Fails if the map does not contain at least the keys in the given multimap, mapping to values that correspond to the values of the given multimap.
      void containsEntry​(java.lang.Object expectedKey, E expectedValue)
      Fails if the multimap does not contain an entry with the given key and a value that corresponds to the given value.
      Ordered containsExactly()
      Fails if the multimap is not empty.
      Ordered containsExactly​(java.lang.Object k0, E v0, java.lang.Object... rest)
      Fails if the multimap does not contain exactly the given set of key/value pairs.
      Ordered containsExactlyEntriesIn​(com.google.common.collect.Multimap<?,​? extends E> expectedMultimap)
      Fails if the map does not contain exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap.
      void doesNotContainEntry​(java.lang.Object excludedKey, E excludedValue)
      Fails if the multimap contains an entry with the given key and a value that corresponds to the given value.
      private com.google.common.collect.Multimap<?,​A> getCastActual()  
      private <K,​V extends E>
      Ordered
      internalContainsAtLeastEntriesIn​(com.google.common.collect.Multimap<K,​V> expectedMultimap)  
      private <K,​V extends E>
      Ordered
      internalContainsExactlyEntriesIn​(com.google.common.collect.Multimap<K,​V> expectedMultimap)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • correspondence

        private final Correspondence<? super A,​? super E> correspondence
    • Constructor Detail

      • UsingCorrespondence

        private UsingCorrespondence​(Correspondence<? super A,​? super E> correspondence)
    • Method Detail

      • containsEntry

        public void containsEntry​(java.lang.Object expectedKey,
                                  E expectedValue)
        Fails if the multimap does not contain an entry with the given key and a value that corresponds to the given value.
      • doesNotContainEntry

        public void doesNotContainEntry​(java.lang.Object excludedKey,
                                        E excludedValue)
        Fails if the multimap contains an entry with the given key and a value that corresponds to the given value.
      • containsExactlyEntriesIn

        public Ordered containsExactlyEntriesIn​(com.google.common.collect.Multimap<?,​? extends E> expectedMultimap)
        Fails if the map does not contain exactly the keys in the given multimap, mapping to values that correspond to the values of the given multimap.

        A subsequent call to Ordered.inOrder() may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key sets iterate in the same order, and the corresponding value collections for each key iterate in the same order.

      • internalContainsExactlyEntriesIn

        private <K,​V extends EOrdered internalContainsExactlyEntriesIn​(com.google.common.collect.Multimap<K,​V> expectedMultimap)
      • containsAtLeastEntriesIn

        public Ordered containsAtLeastEntriesIn​(com.google.common.collect.Multimap<?,​? extends E> expectedMultimap)
        Fails if the map does not contain at least the keys in the given multimap, mapping to values that correspond to the values of the given multimap.

        A subsequent call to Ordered.inOrder() may be made if the caller wishes to verify that the two Multimaps iterate fully in the same order. That is, their key sets iterate in the same order, and the corresponding value collections for each key iterate in the same order.

      • internalContainsAtLeastEntriesIn

        private <K,​V extends EOrdered internalContainsAtLeastEntriesIn​(com.google.common.collect.Multimap<K,​V> expectedMultimap)
      • containsExactly

        public Ordered containsExactly​(java.lang.Object k0,
                                       E v0,
                                       java.lang.Object... rest)
        Fails if the multimap does not contain exactly the given set of key/value pairs.

        Warning: the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!

      • containsExactly

        public Ordered containsExactly()
        Fails if the multimap is not empty.
      • containsAtLeast

        public Ordered containsAtLeast​(java.lang.Object k0,
                                       E v0,
                                       java.lang.Object... rest)
        Fails if the multimap does not contain at least the given key/value pairs.

        Warning: the use of varargs means that we cannot guarantee an equal number of key/value pairs at compile time. Please make sure you provide varargs in key/value pairs!

      • getCastActual

        private com.google.common.collect.Multimap<?,​A> getCastActual()