Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Why do unexpected method calls cause test failure ? #105

Closed
@mariusstaicu

Description

@mariusstaicu

As a user of mocks, I would like to have the possibility to choose which calls I really need to verify.
Therefore, unexpected method calls should issue only a warning in the test fail, in should not cause the test to fail.
ie, in controller.go, instead of:

expected, err := ctrl.expectedCalls.FindMatch(receiver, method, args)
if err != nil {
	origin := callerInfo(2)
	ctrl.t.Fatalf("Unexpected call to %T.%v(%v) at %s because: %s", receiver, method, args, origin, err)
}

should be

expected, err := ctrl.expectedCalls.FindMatch(receiver, method, args)
if err != nil {
	origin := callerInfo(2)
	ctrl.t.Logf("Unexpected call to %T.%v(%v) at %s because: %s", receiver, method, args, origin, err)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions