Package mockit

Class ExpectationsUsingResultFieldTest

java.lang.Object
mockit.ExpectationsUsingResultFieldTest

public final class ExpectationsUsingResultFieldTest extends Object
The Class ExpectationsUsingResultFieldTest.
  • Field Details

    • thrown

      public final org.junit.rules.ExpectedException thrown
      The thrown.
  • Constructor Details

    • ExpectationsUsingResultFieldTest

      public ExpectationsUsingResultFieldTest()
  • Method Details

    • returnsExpectedValues

      public void returnsExpectedValues(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns expected values.
      Parameters:
      mock - the mock
    • recordThrownException

      public void recordThrownException(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record thrown exception.
      Parameters:
      mock - the mock
    • recordThrownError

      public void recordThrownError(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record thrown error.
      Parameters:
      mock - the mock
    • returnsMultipleExpectedValues

      public void returnsMultipleExpectedValues(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns multiple expected values.
      Parameters:
      mock - the mock
    • returnsMultipleExpectedValuesWithMoreInvocationsAllowed

      public void returnsMultipleExpectedValuesWithMoreInvocationsAllowed(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns multiple expected values with more invocations allowed.
      Parameters:
      mock - the mock
    • returnsNullAsDefaultValueForMethodsReturningStringOrObject

      public void returnsNullAsDefaultValueForMethodsReturningStringOrObject(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns null as default value for methods returning string or object.
      Parameters:
      mock - the mock
    • returnsDefaultValuesForPrimitiveAndWrapperReturnTypes

      public void returnsDefaultValuesForPrimitiveAndWrapperReturnTypes(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns default values for primitive and wrapper return types.
      Parameters:
      mock - the mock
    • returnsDefaultValuesForCollectionValuedReturnTypes

      public void returnsDefaultValuesForCollectionValuedReturnTypes(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns default values for collection valued return types.
      Parameters:
      mock - the mock
    • returnsDefaultValuesForIteratorAndIterableReturnTypes

      public void returnsDefaultValuesForIteratorAndIterableReturnTypes(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns default values for iterator and iterable return types.
      Parameters:
      mock - the mock
    • returnsDefaultValuesForArrayValuedReturnTypes

      public void returnsDefaultValuesForArrayValuedReturnTypes(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns default values for array valued return types.
      Parameters:
      mock - the mock
    • returnsMultipleValuesInSequenceUsingCollection

      public void returnsMultipleValuesInSequenceUsingCollection()
      Returns multiple values in sequence using collection.
    • returnsMultipleValuesInSequenceUsingIterator

      public void returnsMultipleValuesInSequenceUsingIterator()
      Returns multiple values in sequence using iterator.
    • returnsMultipleValuesInSequenceUsingArray

      public void returnsMultipleValuesInSequenceUsingArray(mockit.ExpectationsUsingResultFieldTest.Collaborator collaborator)
      Returns multiple values in sequence using array.
      Parameters:
      collaborator - the collaborator
    • returnsMultipleValuesInSequenceUsingIterable

      public void returnsMultipleValuesInSequenceUsingIterable(mockit.ExpectationsUsingResultFieldTest.Collaborator collaborator)
      Returns multiple values in sequence using iterable.
      Parameters:
      collaborator - the collaborator
    • returnsMultipleValuesFromMethodWithReturnTypeOfObject

      public void returnsMultipleValuesFromMethodWithReturnTypeOfObject(mockit.ExpectationsUsingResultFieldTest.Collaborator collaborator)
      Returns multiple values from method with return type of object.
      Parameters:
      collaborator - the collaborator
    • returnsEmptyArrayForMethodWithReturnTypeOfObject

      public void returnsEmptyArrayForMethodWithReturnTypeOfObject(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns empty array for method with return type of object.
      Parameters:
      mock - the mock
    • returnsMultipleValuesFromGenericMethod

      public void returnsMultipleValuesFromGenericMethod(Callable<Integer> callable) throws Exception
      Returns multiple values from generic method.
      Parameters:
      callable - the callable
      Throws:
      Exception - the exception
    • returnsSpecifiedCollectionsForMethodsThatReturnCollections

      public void returnsSpecifiedCollectionsForMethodsThatReturnCollections()
      Returns specified collections for methods that return collections.
    • returnsSpecifiedIteratorForMethodThatReturnsIterator

      public void returnsSpecifiedIteratorForMethodThatReturnsIterator()
      Returns specified iterator for method that returns iterator.
    • returnsValueOfIncompatibleTypeForMethodReturningArray

      public void returnsValueOfIncompatibleTypeForMethodReturningArray(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns value of incompatible type for method returning array.
      Parameters:
      mock - the mock
    • returnsValueOfIncompatibleTypeForMethodReturningCollection

      public void returnsValueOfIncompatibleTypeForMethodReturningCollection(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Returns value of incompatible type for method returning collection.
      Parameters:
      mock - the mock
    • attemptToReturnValueOfTypeSetFromMethodReturningIterator

      public void attemptToReturnValueOfTypeSetFromMethodReturningIterator(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Attempt to return value of type set from method returning iterator.
      Parameters:
      mock - the mock
    • attemptToReturnValueOfTypeListFromMethodReturningIterator

      public void attemptToReturnValueOfTypeListFromMethodReturningIterator(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Attempt to return value of type list from method returning iterator.
      Parameters:
      mock - the mock
    • returnIterableOrIteratorFromRecordedArray

      public void returnIterableOrIteratorFromRecordedArray(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Return iterable or iterator from recorded array.
      Parameters:
      mock - the mock
    • returnMapFromRecordedTwoDimensionalArray

      public void returnMapFromRecordedTwoDimensionalArray(mockit.ExpectationsUsingResultFieldTest.Collaborator mock1, mockit.ExpectationsUsingResultFieldTest.Collaborator mock2)
      Return map from recorded two dimensional array.
      Parameters:
      mock1 - the mock 1
      mock2 - the mock 2
    • recordNullReturnValueForConstructor

      public void recordNullReturnValueForConstructor(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record null return value for constructor.
      Parameters:
      mock - the mock
    • recordNullReturnValueForVoidMethod

      public void recordNullReturnValueForVoidMethod(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record null return value for void method.
      Parameters:
      mock - the mock
    • recordNullReturnValueForVoidMethodAndThenAThrownError

      public void recordNullReturnValueForVoidMethodAndThenAThrownError(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record null return value for void method and then A thrown error.
      Parameters:
      mock - the mock
    • throwExceptionFromSecondInvocationOfConstructor

      public void throwExceptionFromSecondInvocationOfConstructor(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Throw exception from second invocation of constructor.
      Parameters:
      mock - the mock
    • recordReturnValueForVoidMethod

      public void recordReturnValueForVoidMethod(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record return value for void method.
      Parameters:
      mock - the mock
    • recordConsecutiveReturnValuesForVoidMethod

      public void recordConsecutiveReturnValuesForVoidMethod(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record consecutive return values for void method.
      Parameters:
      mock - the mock
    • recordReturnValueForConstructor

      public void recordReturnValueForConstructor(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record return value for constructor.
      Parameters:
      mock - the mock
    • recordReturnValuesMixedWithThrowablesForNonVoidMethod

      public void recordReturnValuesMixedWithThrowablesForNonVoidMethod(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record return values mixed with throwables for non void method.
      Parameters:
      mock - the mock
    • recordExceptionFollowedByNullReturnValueForVoidMethod

      public void recordExceptionFollowedByNullReturnValueForVoidMethod(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record exception followed by null return value for void method.
      Parameters:
      mock - the mock
    • recordArraysOfGenericElementTypes

      public void recordArraysOfGenericElementTypes(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Record arrays of generic element types.
      Parameters:
      mock - the mock
    • createArrayFromSingleRecordedValueOfTheElementType

      public void createArrayFromSingleRecordedValueOfTheElementType(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Creates the array from single recorded value of the element type.
      Parameters:
      mock - the mock
    • createAppropriateContainerFromSingleRecordedValueOfTheElementType

      public void createAppropriateContainerFromSingleRecordedValueOfTheElementType(mockit.ExpectationsUsingResultFieldTest.Collaborator mock)
      Creates the appropriate container from single recorded value of the element type.
      Parameters:
      mock - the mock