Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TikhomirovSergey/84bc9e8619aec2d53992919d01f7b703 to your computer and use it in GitHub Desktop.
Save TikhomirovSergey/84bc9e8619aec2d53992919d01f7b703 to your computer and use it in GitHub Desktop.
@Step("Условие {0}")
protected <T extends Object> void assertThat(Description description, T toBeMatched, Matcher matcher) {
org.junit.Assert.assertThat(toBeMatched, matcher);
}
@Step("{0}:")
public final <T extends Object> AssertSteps assertThat(String message, T toBeMatched, Matcher... matchers) {
checkArgument(matchers.length >= 0, "Число проверок должно быть больше 0:");
for (Matcher<?> matcher: matchers) {
this.assertThat(new StringDescription().appendText(message).appendText("\n").appendDescriptionOf(matcher),
toBeMatched, matcher);
}
return this;
}
@Step("{0}")
public AssertSteps perform(@NotNull String description, @NotNull Consumer<AssertSteps> stepsConsumer) {
return PerformStep.super.perform(description, stepsConsumer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment