Skip to content

Commit

Permalink
Fixes fragile test
Browse files Browse the repository at this point in the history
Closes #76
  • Loading branch information
Adrian Cole committed Feb 11, 2016
1 parent 3182bb0 commit 408203d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import zipkin.Endpoint;
import zipkin.Span;

import static org.hamcrest.CoreMatchers.startsWith;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void writeSpans_malformedJsonIsBadRequest() throws Exception {
mockMvc
.perform(post("/api/v1/spans").content(body))
.andExpect(status().isBadRequest())
.andExpect(content().string("Malformed reading List<Span> from json: hello"));
.andExpect(content().string(startsWith("Malformed reading List<Span> from json: hello")));
}

@Test
Expand All @@ -80,7 +81,7 @@ public void writeSpans_malformedThriftIsBadRequest() throws Exception {
mockMvc
.perform(post("/api/v1/spans").content(body).contentType("application/x-thrift"))
.andExpect(status().isBadRequest())
.andExpect(content().string("Malformed reading List<Span> from TBinary: aGVsbG8="));
.andExpect(content().string(startsWith("Malformed reading List<Span> from TBinary: aGVsbG8=")));
}

static Span newSpan(long traceId, long id, String spanName, String value, String service) {
Expand Down

0 comments on commit 408203d

Please sign in to comment.