dreamhead / moco

Easy Setup Stub Server
MIT License
4.35k stars 1.08k forks source link

fixed wrong array match in json struct request matcher #307

Closed tian-pengfei closed 2 years ago

tian-pengfei commented 2 years ago

test

 @Test(expected = HttpResponseException.class)
    public void should_match_same_structure_json_with_resource() throws Exception {
        final String jsonContent = "{\"foo\":\"bar\",\"foo2\":[\"bar\"]}";
        final String jsonContent2 = "{\"foo\":\"bar\",\"foo2\":[\"bar\",2,3]}";
        server.request(struct(json(jsonContent))).response("foo");
        running(server, () -> assertThat(helper.postContent(root(), jsonContent2), is("foo")));
    }

before fixed: result:

Results: FAILURE (1 tests, 0 successes, 1 failures, 0 skipped)
BUILD FAILED in 4s

after fixed

Results: SUCCESS (1 tests, 1 successes, 0 failures, 0 skipped)
BUILD SUCCESSFUL in 4s
4 actionable tasks: 2 executed, 2 up-to-date