mirror of
https://github.com/stretchr/testify.git
synced 2025-05-31 11:42:44 +00:00
Refactored Test_Mock_IsMethodCallable
This commit is contained in:
parent
6bf5d94027
commit
3a72ffb6d8
@ -1146,29 +1146,20 @@ func Test_Mock_AssertNotCalled(t *testing.T) {
|
|||||||
func Test_Mock_IsMethodCallable(t *testing.T) {
|
func Test_Mock_IsMethodCallable(t *testing.T) {
|
||||||
var mockedService = new(TestExampleImplementation)
|
var mockedService = new(TestExampleImplementation)
|
||||||
|
|
||||||
mockedService.On("Test_Mock_IsMethodCallable", 1, 5).Return(5, 5).Twice()
|
arg := []Call{{Repeatability: 1}, {Repeatability: 1}}
|
||||||
|
arg2 := []Call{{Repeatability: 1}, {Repeatability: 2}}
|
||||||
|
arg3 := []Call{{Repeatability: 1}, {Repeatability: 1}}
|
||||||
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1))
|
mockedService.On("Test_Mock_IsMethodCallable", arg).Return(true).Twice()
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1, 6))
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 2, 5))
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1, int64(5)))
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_Check", 1, 5))
|
|
||||||
|
|
||||||
assert.True(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1, 5))
|
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", arg2))
|
||||||
mockedService.MethodCalled("Test_Mock_IsMethodCallable", 1, 5)
|
assert.True(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", arg))
|
||||||
assert.True(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1, 5))
|
assert.True(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", arg3))
|
||||||
mockedService.MethodCalled("Test_Mock_IsMethodCallable", 1, 5)
|
|
||||||
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", 1, 5))
|
mockedService.MethodCalled("Test_Mock_IsMethodCallable", arg)
|
||||||
|
mockedService.MethodCalled("Test_Mock_IsMethodCallable", arg)
|
||||||
|
|
||||||
arr := Call{Repeatability: 1}
|
assert.False(t, mockedService.IsMethodCallable(t, "Test_Mock_IsMethodCallable", arg))
|
||||||
mockedService.On("Function", arr).Return(true).Twice()
|
|
||||||
assert.True(t, mockedService.IsMethodCallable(t, "Function", arr))
|
|
||||||
mockedService.MethodCalled("Function", arr)
|
|
||||||
assert.True(t, mockedService.IsMethodCallable(t, "Function", arr))
|
|
||||||
mockedService.MethodCalled("Function", arr)
|
|
||||||
|
|
||||||
assert.False(t, mockedService.IsMethodCallable(t, "Function", arr))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIsArgsEqual(t *testing.T) {
|
func TestIsArgsEqual(t *testing.T) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user