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

SimpleRequestExpectationManager fails with sequential calls with different count [SPR-15672] #20231

Closed
spring-projects-issues opened this issue Jun 16, 2017 · 1 comment
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jun 16, 2017

Pablo Santiago opened SPR-15672 and commented

When creating a MockRestServiceServer and setting a sequential expectation with different counts, it fails:

public class ExpectedCountTest {

    private SimpleRequestExpectationManager manager = new SimpleRequestExpectationManager();

    @Test
    public void sequentialRequestsWithDifferentCount() throws Exception {
        this.manager.expectRequest(times(2), requestTo("/foo")).andExpect(method(GET)).andRespond(withSuccess());
        this.manager.expectRequest(once(), requestTo("/bar")).andExpect(method(GET)).andRespond(withSuccess());

        this.manager.validateRequest(createRequest(GET, "/foo"));
        this.manager.validateRequest(createRequest(GET, "/foo"));
        this.manager.validateRequest(createRequest(GET, "/bar"));
    }

    private ClientHttpRequest createRequest(HttpMethod method, String url) {
        return new MockAsyncClientHttpRequest(method, URI.create(url));
    }

}

Affects: 4.3.8

Reference URL: https://github.com/spring-projects/spring-framework-issues/tree/master/SPR-15672

Issue Links:

  • #20275 MockRestServiceServer does not honor expectation order with expectations that mandate more than 1 execution. ("supersedes")

Referenced from: commits efb735a, a17255a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants