Closed iainmcgin closed 6 years ago
There's some fancy footwork in this CL to allow fluent assertions about parameter values; I don't know if there is precedent for this elsewhere, or if it is frowned upon. For example, with this patch you can write:
assertThat(uri) .hasQueryParameter("user").withValue("bob@example.com") .hasQueryParameter("married") .hasQueryParameter("pets").withValues("Spot", "Daisy");
Whereas more conventionally I think you would have to write:
assertThat(uri).hasQueryParameter("user"); assertThat(uri.getQueryParameter("user")).isEqualTo("bob@example.com"); assertThat(uri.getQueryParameters("pets")).contains("Spot", "Daisy");
If you don't think the "withValue" extra fluent method is valuable, I can take that out, but personally I prefer it.
Why not keep it simple — assertThat(uri).hasQueryParameter("user", "bob@example.com")?
assertThat(uri).hasQueryParameter("user", "bob@example.com")
There's some fancy footwork in this CL to allow fluent assertions about parameter values; I don't know if there is precedent for this elsewhere, or if it is frowned upon. For example, with this patch you can write:
Whereas more conventionally I think you would have to write:
If you don't think the "withValue" extra fluent method is valuable, I can take that out, but personally I prefer it.