Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test command with mockito #102

Open
EmadBeltaje opened this issue Aug 2, 2024 · 0 comments
Open

Test command with mockito #102

EmadBeltaje opened this issue Aug 2, 2024 · 0 comments

Comments

@EmadBeltaje
Copy link

EmadBeltaje commented Aug 2, 2024

Hello iam trying to mock my command for testing and iam having alot of problems so iam asking for a simple example for mocking command with mockito lets take this command from the your doc

class CommitCommand extends Command {
  final name = "commit";
  final description = "Record changes to the repository.";

  // [run] may also return a Future.
  void run() {
     if(commit()){
        exist(0);
     }else {
        exist(1);
     }
  }

  bool commit() => true;
}

how can i mock this and simulate if commit returned true or false simple example cause when iam trying to do it i faced alot of errors

@mosuem mosuem transferred this issue from dart-archive/args Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants