/external/mockito/src/test/java/org/mockitousage/stubbing/ |
D | StubbingConsecutiveAnswersTest.java | 24 when(mock.simpleMethod()) in should_return_consecutive_values() 29 assertEquals("one", mock.simpleMethod()); in should_return_consecutive_values() 30 assertEquals("two", mock.simpleMethod()); in should_return_consecutive_values() 31 assertEquals("three", mock.simpleMethod()); in should_return_consecutive_values() 32 assertEquals("three", mock.simpleMethod()); in should_return_consecutive_values() 33 assertEquals("three", mock.simpleMethod()); in should_return_consecutive_values() 38 when(mock.simpleMethod()).thenReturn(null, (String[]) null); in should_return_consecutive_values_for_two_nulls() 40 assertNull(mock.simpleMethod()); in should_return_consecutive_values_for_two_nulls() 41 assertNull(mock.simpleMethod()); in should_return_consecutive_values_for_two_nulls() 46 when(mock.simpleMethod()).thenReturn("one", (String) null); in should_return_consecutive_values_first_var_arg_null() [all …]
|
D | StubbingUsingDoReturnTest.java | 37 doReturn("foo").when(mock).simpleMethod(); in should_stub() 38 doReturn("bar").when(mock).simpleMethod(); in should_stub() 40 Assertions.assertThat(mock.simpleMethod()).isEqualTo("bar"); in should_stub() 45 doReturn("foo").when(mock).simpleMethod("foo"); in should_stub_with_args() 46 doReturn("bar").when(mock).simpleMethod(eq("one"), anyInt()); in should_stub_with_args() 48 Assertions.assertThat(mock.simpleMethod("foo")).isEqualTo("foo"); in should_stub_with_args() 49 Assertions.assertThat(mock.simpleMethod("one", 234)).isEqualTo("bar"); in should_stub_with_args() 50 Assertions.assertThat(mock.simpleMethod("xxx", 234)).isEqualTo(null); in should_stub_with_args() 123 .when(mock).simpleMethod(); in should_allow_chained_stubbing() 125 Assertions.assertThat(mock.simpleMethod()).isEqualTo("foo"); in should_allow_chained_stubbing() [all …]
|
D | StrictStubbingTest.java | 40 mock.simpleMethod(100); in few_interactions() 46 mock.simpleMethod(100); in few_verified_interactions() 50 verify(mock).simpleMethod(100); in few_verified_interactions() 57 given(mock.simpleMethod(100)).willReturn("100"); in stubbed_method_is_implicitly_verified() 58 mock.simpleMethod(100); in stubbed_method_is_implicitly_verified() 66 given(mock.simpleMethod(100)).willReturn("100"); in unused_stubbed_is_not_implicitly_verified() 67 mock.simpleMethod(100); // <- implicitly verified in unused_stubbed_is_not_implicitly_verified() 68 mock.simpleMethod(200); // <- unverified in unused_stubbed_is_not_implicitly_verified() 80 given(mock.simpleMethod(100)).willReturn("100"); in stubbing_argument_mismatch() 85 mock.simpleMethod(200); in stubbing_argument_mismatch() [all …]
|
D | StrictStubbingEndToEndTest.java | 90 given(mock.simpleMethod("1")).willReturn("one"); in unnecessary_stubbing() 104 given(mock.simpleMethod(1)).willReturn(""); in mismatch() 105 mock.simpleMethod(2); in mismatch() 118 given(mock.simpleMethod(1)).willReturn(""); in used() 119 mock.simpleMethod(1); in used() 127 given(mock.simpleMethod(1)).willReturn(""); in unused() 131 given(mock.simpleMethod(2)).willReturn(""); in mismatch() 132 mock.simpleMethod(3); in mismatch() 140 given(mock.simpleMethod(1)).willReturn(""); in unused() 144 given(mock.simpleMethod(2)).willReturn(""); in mismatch() [all …]
|
D | StubbingWithAdditionalAnswersTest.java | 90 given(iMethods.simpleMethod(anyString())) in can_return_based_on_strongly_types_one_parameter_function() 97 assertThat(iMethods.simpleMethod("string")).isEqualTo("string"); in can_return_based_on_strongly_types_one_parameter_function() 104 given(iMethods.simpleMethod(anyString())) in will_execute_a_void_based_on_strongly_typed_one_parameter_function() 107 target.simpleMethod(s); in will_execute_a_void_based_on_strongly_typed_one_parameter_function() 112 iMethods.simpleMethod("string"); in will_execute_a_void_based_on_strongly_typed_one_parameter_function() 115 verify(target, times(1)).simpleMethod("string"); in will_execute_a_void_based_on_strongly_typed_one_parameter_function() 120 given(iMethods.simpleMethod(anyString(), anyInt())) in can_return_based_on_strongly_typed_two_parameter_function() 127 assertThat(iMethods.simpleMethod("string",1)).isEqualTo("string-1"); in can_return_based_on_strongly_typed_two_parameter_function() 134 given(iMethods.simpleMethod(anyString(), anyInt())) in will_execute_a_void_based_on_strongly_typed_two_parameter_function() 137 target.simpleMethod(s, i); in will_execute_a_void_based_on_strongly_typed_two_parameter_function() [all …]
|
/external/mockito/src/test/java/org/mockitousage/verification/ |
D | BasicVerificationInOrderTest.java | 37 mockOne.simpleMethod(1); in setUp() 38 mockTwo.simpleMethod(2); in setUp() 39 mockTwo.simpleMethod(2); in setUp() 40 mockThree.simpleMethod(3); in setUp() 41 mockTwo.simpleMethod(2); in setUp() 42 mockOne.simpleMethod(4); in setUp() 47 inOrder.verify(mockOne).simpleMethod(1); in shouldVerifyInOrder() 48 inOrder.verify(mockTwo, times(2)).simpleMethod(2); in shouldVerifyInOrder() 49 inOrder.verify(mockThree).simpleMethod(3); in shouldVerifyInOrder() 50 inOrder.verify(mockTwo).simpleMethod(2); in shouldVerifyInOrder() [all …]
|
D | RelaxedVerificationInOrderTest.java | 39 mockOne.simpleMethod(1); in setUp() 40 mockTwo.simpleMethod(2); in setUp() 41 mockTwo.simpleMethod(2); in setUp() 42 mockThree.simpleMethod(3); in setUp() 43 mockTwo.simpleMethod(2); in setUp() 44 mockOne.simpleMethod(4); in setUp() 49 inOrder.verify(mockOne).simpleMethod(1); in shouldVerifyInOrderAllInvocations() 50 inOrder.verify(mockTwo, times(2)).simpleMethod(2); in shouldVerifyInOrderAllInvocations() 51 inOrder.verify(mockThree).simpleMethod(3); in shouldVerifyInOrderAllInvocations() 52 inOrder.verify(mockTwo).simpleMethod(2); in shouldVerifyInOrderAllInvocations() [all …]
|
D | VerificationInOrderMixedWithOrdiraryVerificationTest.java | 33 mockOne.simpleMethod(1); in setUp() 34 mockOne.simpleMethod(1); in setUp() 35 mockTwo.simpleMethod(2); in setUp() 36 mockThree.simpleMethod(3); in setUp() 37 mockThree.simpleMethod(4); in setUp() 44 inOrder.verify(mockOne, atLeastOnce()).simpleMethod(1); in shouldMixVerificationInOrderAndOrdinaryVerification() 45 inOrder.verify(mockThree).simpleMethod(3); in shouldMixVerificationInOrderAndOrdinaryVerification() 46 inOrder.verify(mockThree).simpleMethod(4); in shouldMixVerificationInOrderAndOrdinaryVerification() 47 verify(mockTwo).simpleMethod(2); in shouldMixVerificationInOrderAndOrdinaryVerification() 54 inOrder.verify(mockOne, atLeastOnce()).simpleMethod(1); in shouldAllowOrdinarilyVerifyingMockPassedToInOrderObject() [all …]
|
D | SelectedMocksInOrderVerificationTest.java | 31 mockOne.simpleMethod(1); in setUp() 32 mockTwo.simpleMethod(2); in setUp() 33 mockTwo.simpleMethod(2); in setUp() 34 mockThree.simpleMethod(3); in setUp() 35 mockTwo.simpleMethod(2); in setUp() 36 mockOne.simpleMethod(4); in setUp() 42 inOrder.verify(mockOne).simpleMethod(1); in shouldVerifyAllInvocationsInOrder() 43 inOrder.verify(mockTwo, times(2)).simpleMethod(2); in shouldVerifyAllInvocationsInOrder() 44 inOrder.verify(mockThree).simpleMethod(3); in shouldVerifyAllInvocationsInOrder() 45 inOrder.verify(mockTwo).simpleMethod(2); in shouldVerifyAllInvocationsInOrder() [all …]
|
D | VerificationInOrderTest.java | 41 mockOne.simpleMethod(1); in shouldVerifySingleMockInOrderAndNotInOrder() 42 mockOne.simpleMethod(2); in shouldVerifySingleMockInOrderAndNotInOrder() 44 verify(mockOne).simpleMethod(2); in shouldVerifySingleMockInOrderAndNotInOrder() 45 verify(mockOne).simpleMethod(1); in shouldVerifySingleMockInOrderAndNotInOrder() 47 inOrder.verify(mockOne).simpleMethod(2); in shouldVerifySingleMockInOrderAndNotInOrder() 49 inOrder.verify(mockOne).simpleMethod(1); in shouldVerifySingleMockInOrderAndNotInOrder() 57 mockOne.simpleMethod(); in shouldMessagesPointToProperMethod() 69 mockOne.simpleMethod(); in shouldVerifyInOrderWhenTwoChunksAreEqual() 70 mockOne.simpleMethod(); in shouldVerifyInOrderWhenTwoChunksAreEqual() 72 mockOne.simpleMethod(); in shouldVerifyInOrderWhenTwoChunksAreEqual() [all …]
|
D | DescriptiveMessagesOnVerificationInOrderErrorsTest.java | 34 one.simpleMethod(1); in setup() 35 one.simpleMethod(11); in setup() 36 two.simpleMethod(2); in setup() 37 two.simpleMethod(2); in setup() 38 three.simpleMethod(3); in setup() 45 inOrder.verify(one).simpleMethod(1); in shouldPrintVerificationInOrderErrorAndShowBothWantedAndPrevious() 46 inOrder.verify(two, atLeastOnce()).simpleMethod(2); in shouldPrintVerificationInOrderErrorAndShowBothWantedAndPrevious() 49 inOrder.verify(one, atLeastOnce()).simpleMethod(11); in shouldPrintVerificationInOrderErrorAndShowBothWantedAndPrevious() 97 inOrder.verify(one).simpleMethod(999); in shouldPrintVerificationInOrderErrorAndShowWantedAndActual() 107 inOrder.verify(three).simpleMethod(3); in shouldNotSayArgumentsAreDifferent() [all …]
|
D | FindingRedundantInvocationsInOrderTest.java | 38 mock.simpleMethod(); in shouldSayNoInteractionsWanted() 53 mock.simpleMethod(); in shouldVerifyNoMoreInteractionsInOrder() 54 mock.simpleMethod(10); in shouldVerifyNoMoreInteractionsInOrder() 59 inOrder.verify(mock).simpleMethod(10); in shouldVerifyNoMoreInteractionsInOrder() 67 mock.simpleMethod(); in shouldVerifyNoMoreInteractionsInOrderWithMultipleMocks() 68 mock2.simpleMethod(); in shouldVerifyNoMoreInteractionsInOrderWithMultipleMocks() 73 inOrder.verify(mock2).simpleMethod(); in shouldVerifyNoMoreInteractionsInOrderWithMultipleMocks() 81 mock.simpleMethod(); in shouldFailToVerifyNoMoreInteractionsInOrder() 82 mock.simpleMethod(10); in shouldFailToVerifyNoMoreInteractionsInOrder() 87 inOrder.verify(mock).simpleMethod(10); in shouldFailToVerifyNoMoreInteractionsInOrder() [all …]
|
D | DescriptiveMessagesWhenVerificationFailsTest.java | 37 verify(mock).simpleMethod(); in should_print_method_name() 135 mock.simpleMethod(); in should_print_actual_and_wanted_when_actual_method_name_and_wanted_method_name_are_the_same() 138 verify(mock).simpleMethod(10); in should_print_actual_and_wanted_when_actual_method_name_and_wanted_method_name_are_the_same() 271 mock.simpleMethod("foo"); in should_print_method_when_missing_invocation_with_matcher() 274 verify(mock).simpleMethod(matches("burrito from Exmouth")); in should_print_method_when_missing_invocation_with_matcher() 285 mock.simpleMethod(null, (Integer) null); in should_print_null_arguments() 287 verify(mock).simpleMethod("test"); in should_print_null_arguments() 296 mock.simpleMethod(1); in should_say_never_wanted_but_invoked() 298 verify(mock, never()).simpleMethod(2); in should_say_never_wanted_but_invoked() 300 verify(mock, never()).simpleMethod(1); in should_say_never_wanted_but_invoked() [all …]
|
/external/mockito/src/test/java/org/mockitousage/strictness/ |
D | StrictnessPerStubbingTest.java | 44 when(mock.simpleMethod("1")).thenReturn("1"); in potential_stubbing_problem() 54 mock.simpleMethod("100"); in potential_stubbing_problem() 63 .when(mock).simpleMethod(1); in doReturn_syntax() 66 mock.simpleMethod(200); in doReturn_syntax() 69 assertEquals("2", mock.simpleMethod(1)); in doReturn_syntax() 70 assertEquals("3", mock.simpleMethod(1)); in doReturn_syntax() 77 .when(mock).simpleMethod(1); in doReturn_varargs_syntax() 80 mock.simpleMethod(200); in doReturn_varargs_syntax() 83 assertEquals("2", mock.simpleMethod(1)); in doReturn_varargs_syntax() 84 assertEquals("3", mock.simpleMethod(1)); in doReturn_varargs_syntax() [all …]
|
/external/mockito/src/test/java/org/mockitousage/stacktrace/ |
D | PointingStackTraceToActualInvocationChunkInOrderTest.java | 40 mock.simpleMethod(1); in firstChunk() 41 mock.simpleMethod(1); in firstChunk() 44 mockTwo.simpleMethod(2); in secondChunk() 45 mockTwo.simpleMethod(2); in secondChunk() 48 mock.simpleMethod(3); in thirdChunk() 49 mock.simpleMethod(3); in thirdChunk() 52 mockTwo.simpleMethod(4); in fourthChunk() 53 mockTwo.simpleMethod(4); in fourthChunk() 58 inOrder.verify(mock, times(2)).simpleMethod(anyInt()); in shouldPointStackTraceToPreviousInvocation() 59 inOrder.verify(mockTwo, times(2)).simpleMethod(anyInt()); in shouldPointStackTraceToPreviousInvocation() [all …]
|
D | PointingStackTraceToActualInvocationInOrderTest.java | 41 mock.simpleMethod(1); in first() 44 mockTwo.simpleMethod(2); in second() 47 mock.simpleMethod(3); in third() 50 mockTwo.simpleMethod(4); in fourth() 55 inOrder.verify(mock, atLeastOnce()).simpleMethod(anyInt()); in shouldPointStackTraceToPreviousVerified() 56 inOrder.verify(mockTwo).simpleMethod(anyInt()); in shouldPointStackTraceToPreviousVerified() 59 inOrder.verify(mock).simpleMethod(999); in shouldPointStackTraceToPreviousVerified() 68 inOrder.verify(mock, atLeastOnce()).simpleMethod(anyInt()); in shouldPointToThirdMethod() 71 inOrder.verify(mockTwo).simpleMethod(999); in shouldPointToThirdMethod() 80 inOrder.verify(mock).simpleMethod(anyInt()); in shouldPointToSecondMethod() [all …]
|
D | ModellingDescriptiveMessagesTest.java | 52 verify(mock).simpleMethod(); in shouldPointOutInteractionsOnMockWhenOrdinaryVerificationFails() 57 mock.simpleMethod("blah"); in shouldShowActualAndExpected() 58 verify(mock).simpleMethod(); in shouldShowActualAndExpected() 63 mock.simpleMethod(); in shouldSayTooLittleInvocations() 64 verify(mock, times(2)).simpleMethod(); in shouldSayTooLittleInvocations() 69 mock.simpleMethod(); in shouldSayTooManyInvocations() 70 mock.simpleMethod(); in shouldSayTooManyInvocations() 71 verify(mock, times(1)).simpleMethod(); in shouldSayTooManyInvocations() 76 mock.simpleMethod(); in shouldSayWantedButNotInvokedInOrder() 80 inOrder.verify(mock).simpleMethod(); in shouldSayWantedButNotInvokedInOrder() [all …]
|
/external/mockito/src/test/java/org/mockitousage/junitrule/ |
D | StrictJUnitRuleTest.java | 35 mock.simpleMethod(); in ok_when_no_stubbings() 36 verify(mock).simpleMethod(); in ok_when_no_stubbings() 40 given(mock.simpleMethod(10)).willReturn("foo"); in ok_when_all_stubbings_used() 41 mock.simpleMethod(10); in ok_when_all_stubbings_used() 45 given(mock.simpleMethod(10)).willReturn("foo"); in ok_when_used_and_mismatched_argument() 46 mock.simpleMethod(10); in ok_when_used_and_mismatched_argument() 47 mock.simpleMethod(15); in ok_when_used_and_mismatched_argument() 55 given(mock.simpleMethod(10)).willReturn("foo"); in fails_when_unused_stubbings() 56 mock2.simpleMethod(10); in fails_when_unused_stubbings() 64 given(mock.simpleMethod(10)).willReturn("foo"); in test_failure_trumps_unused_stubbings() [all …]
|
D | VerificationCollectorImplTest.java | 27 methods.simpleMethod(); in should_not_throw_any_exceptions_when_verifications_are_successful() 29 verify(methods).simpleMethod(); in should_not_throw_any_exceptions_when_verifications_are_successful() 39 verify(methods).simpleMethod(); in should_collect_verification_failures() 49 verify(methods).simpleMethod(); in should_collect_multiple_verification_failures() 66 verify(methods, never()).simpleMethod(); in should_only_collect_failures_ignore_successful_verifications() 77 methods.simpleMethod(); in should_continue_collecting_after_failing_verification() 80 verify(methods).simpleMethod(); in should_continue_collecting_after_failing_verification() 114 verify(methods).simpleMethod(); in should_fail() 120 methods.simpleMethod(); in should_not_fail() 122 verify(methods).simpleMethod(); in should_not_fail()
|
/external/mockito/src/test/java/org/mockitousage/internal/junit/ |
D | UnusedStubbingsFinderTest.java | 44 mock1.simpleMethod(); in no_stubbings() 54 when(mock1.simpleMethod()).thenReturn("1"); in no_unused_stubbings() 55 mock1.simpleMethod(); in no_unused_stubbings() 65 when(mock1.simpleMethod()).thenReturn("1"); in unused_stubbings() 74 when(mock1.simpleMethod(1)).thenReturn("1"); in some_unused_stubbings() 75 when(mock2.simpleMethod(2)).thenReturn("2"); in some_unused_stubbings() 76 when(mock2.simpleMethod(3)).thenReturn("3"); in some_unused_stubbings() 78 mock2.simpleMethod(2); in some_unused_stubbings() 91 when(mock1.simpleMethod(1)).thenReturn("1"); in unused_and_lenient_stubbings() 92 when(mock1.simpleMethod(2)).thenReturn("2"); in unused_and_lenient_stubbings() [all …]
|
/external/mockito/src/test/java/org/mockito/internal/junit/ |
D | ArgMismatchFinderTest.java | 34 when(mock1.simpleMethod(1)).thenReturn("1"); in no_mismatch_when_mock_different() 35 mock2.simpleMethod(2); //arg mismatch on different mock in no_mismatch_when_mock_different() 47 when(mock1.simpleMethod(1)).thenReturn("1"); in no_mismatch_when_method_different() 60 when(mock1.simpleMethod(1)).thenReturn("1"); in no_mismatch_when_stubbing_used() 61 mock1.simpleMethod(1); // stub used in no_mismatch_when_stubbing_used() 62 mock1.simpleMethod(2); // no stubbing, but we don't want it to be reported, either in no_mismatch_when_stubbing_used() 74 when(mock1.simpleMethod(1)).thenReturn("1"); in stubbing_mismatch() 75 mock1.simpleMethod(2); in stubbing_mismatch() 87 when(mock1.simpleMethod(1)).thenReturn("1"); in single_mismatch_with_multiple_invocations() 88 mock1.simpleMethod(2); in single_mismatch_with_multiple_invocations() [all …]
|
/external/mockito/src/test/java/org/mockitousage/matchers/ |
D | VerificationAndStubbingUsingMatchersTest.java | 32 when(one.simpleMethod(2)).thenReturn("2"); in shouldStubUsingMatchers() 33 when(two.simpleMethod(anyString())).thenReturn("any"); in shouldStubUsingMatchers() 34 when(three.simpleMethod(startsWith("test"))).thenThrow(new RuntimeException()); in shouldStubUsingMatchers() 36 assertEquals(null, one.simpleMethod(1)); in shouldStubUsingMatchers() 37 assertEquals("2", one.simpleMethod(2)); in shouldStubUsingMatchers() 39 assertEquals("any", two.simpleMethod("two")); in shouldStubUsingMatchers() 40 assertEquals("any", two.simpleMethod("two again")); in shouldStubUsingMatchers() 42 assertEquals(null, three.simpleMethod("three")); in shouldStubUsingMatchers() 43 assertEquals(null, three.simpleMethod("three again")); in shouldStubUsingMatchers() 46 three.simpleMethod("test three again"); in shouldStubUsingMatchers() [all …]
|
/external/mockito/src/test/java/org/mockitousage/junitrunner/ |
D | StubbingWarningsJUnitRunnerTest.java | 68 when(mock.simpleMethod(1)).thenReturn("1"); in test() 69 mock.simpleMethod(2); in test() 77 when(mock.simpleMethod(1)).thenReturn("1"); in test() 78 mock.simpleMethod(2); in test() 87 when(mock.simpleMethod(1)).thenReturn("1"); in test() 88 mock.simpleMethod(1); in test() 97 when(mock.simpleMethod(1)).thenReturn("1"); // <- used in test() 98 when(mock.simpleMethod(2)).thenReturn("2"); // <- unused in test() 100 mock.simpleMethod(1); // <- not reported in test() 101 mock.simpleMethod(3); // <- reported in test() [all …]
|
D | StrictRunnerTest.java | 84 assertEquals("1", mock.simpleMethod(1)); in test() 90 IMethods mock = when(mock(IMethods.class).simpleMethod(1)).thenReturn("1").getMock(); 97 assertEquals("1", mock.simpleMethod(1)); in test() 105 when(mock.simpleMethod(1)).thenReturn("1"); in before() 114 when(mock.simpleMethod(1)).thenReturn("1"); in test() 115 assertEquals("1", mock.simpleMethod(1)); in test() 123 when(mock.simpleMethod(1)).thenReturn("1"); in test() 124 mock.simpleMethod(2); //different arg in test() 137 when(mock2.simpleMethod("unused stubbing")).thenReturn(""); in before() 141 when(mock.simpleMethod(1)).thenReturn("1"); in passing_test() [all …]
|
/external/mockito/src/test/java/org/mockitousage/customization/ |
D | BDDMockitoTest.java | 33 given(mock.simpleMethod("foo")).willReturn("bar"); in should_stub() 35 Assertions.assertThat(mock.simpleMethod("foo")).isEqualTo("bar"); in should_stub() 36 Assertions.assertThat(mock.simpleMethod("whatever")).isEqualTo(null); in should_stub() 41 given(mock.simpleMethod("foo")).willThrow(new SomethingWasWrong()); in should_stub_with_throwable() 44 Assertions.assertThat(mock.simpleMethod("foo")).isEqualTo("foo"); in should_stub_with_throwable() 52 given(mock.simpleMethod("foo")).willThrow(SomethingWasWrong.class); in should_stub_with_throwable_class() 55 Assertions.assertThat(mock.simpleMethod("foo")).isEqualTo("foo"); in should_stub_with_throwable_class() 65 … given(mock.simpleMethod("foo")).willThrow(SomethingWasWrong.class, AnotherThingWasWrong.class); in should_stub_with_throwable_classes() 68 Assertions.assertThat(mock.simpleMethod("foo")).isEqualTo("foo"); in should_stub_with_throwable_classes() 76 given(mock.simpleMethod(anyString())).willAnswer(new Answer<String>() { in should_stub_with_answer() [all …]
|