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

Chaining Expectations In MockClient #531

Open
ryber opened this issue Aug 18, 2024 · 0 comments
Open

Chaining Expectations In MockClient #531

ryber opened this issue Aug 18, 2024 · 0 comments
Labels
Feature Request Valid feature request to add to the backlog

Comments

@ryber
Copy link
Collaborator

ryber commented Aug 18, 2024

Is your feature request related to a problem? Please describe.
The ability to chain and order expectations in the MockClient

Describe the solution you'd like
this is a simple example. This should work but the first assert fails because the the last expect overrides the first one

      var mock = MockClient.register();
        mock.expect(GET,"http://path/one").thenReturn(FORBIDDEN);
        mock.expect(GET,"http://path/one").thenReturn(OK);

        assertEquals(FORBIDDEN, Unirest.get("http://path/one").asEmpty().getStatus());
        assertEquals(OK, Unirest.get("http://path/one").asEmpty().getStatus());
@ryber ryber added the Feature Request Valid feature request to add to the backlog label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Valid feature request to add to the backlog
Projects
None yet
Development

No branches or pull requests

1 participant