Package org.jmock

Class AbstractExpectations

    • Constructor Detail

      • AbstractExpectations

        public AbstractExpectations()
    • Method Detail

      • initialiseExpectationCapture

        private void initialiseExpectationCapture​(Cardinality cardinality)
      • checkLastExpectationWasFullySpecified

        private void checkLastExpectationWasFullySpecified()
      • one

        public <T> T one​(T mockObject)
        Deprecated.
        Use oneOf instead.
        Specified by:
        one in interface CardinalityClause
      • addParameterMatcher

        protected void addParameterMatcher​(org.hamcrest.Matcher<?> matcher)
      • with

        public <T> T with​(org.hamcrest.Matcher<T> matcher)
        For Matchers with primitive types use the with field, for example:
        with.intIs(equalTo(34));
        For untyped matchers use:
        with.<T>is(equalTo(anObject));
        Specified by:
        with in interface ArgumentConstraintPhrases
      • with

        public boolean with​(boolean value)
      • with

        public byte with​(byte value)
      • with

        public short with​(short value)
      • with

        public char with​(char value)
      • with

        public int with​(int value)
      • with

        public long with​(long value)
      • with

        public float with​(float value)
      • with

        public double with​(double value)
      • with

        public <T> T with​(T value)
      • equal

        public static <T> org.hamcrest.Matcher<T> equal​(T value)
      • same

        public static <T> org.hamcrest.Matcher<T> same​(T value)
      • any

        public static <T> org.hamcrest.Matcher<T> any​(java.lang.Class<T> type)
      • anything

        public static <T> org.hamcrest.Matcher<T> anything()
      • a

        @Deprecated
        public static org.hamcrest.Matcher<java.lang.Object> a​(java.lang.Class<?> type)
        Deprecated.
        use aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Java
        Parameters:
        type - Class to match. Do not use for native parameters.
        Returns:
        an IsInstanceOf matcher
      • an

        @Deprecated
        public static org.hamcrest.Matcher<java.lang.Object> an​(java.lang.Class<?> type)
        Deprecated.
        use aNonNull(java.lang.Class<T>) or any(java.lang.Class<T>) until type inference actually works in a future version of Java
        Parameters:
        type - Class to match. Do not use for native parameters.
        Returns:
        an IsInstanceOf matcher
      • aNull

        public static <T> org.hamcrest.Matcher<T> aNull​(java.lang.Class<T> type)
      • aNonNull

        public static <T> org.hamcrest.Matcher<T> aNonNull​(java.lang.Class<T> type)
      • returnValue

        public static Action returnValue​(java.lang.Object result)
      • throwException

        public static Action throwException​(java.lang.Throwable throwable)
      • returnIterator

        public static Action returnIterator​(java.util.Collection<?> collection)
      • returnIterator

        public static <T> Action returnIterator​(T... items)
      • returnEnumeration

        public static Action returnEnumeration​(java.util.Collection<?> collection)
      • returnEnumeration

        public static <T> Action returnEnumeration​(T... items)
      • onConsecutiveCalls

        public static Action onConsecutiveCalls​(Action... actions)
      • then

        public void then​(State state)
      • inSequence

        public void inSequence​(Sequence sequence)
      • inSequences

        public void inSequences​(Sequence... sequences)