About Assertions−3
I mentioned a situation, where we need to repeat fix, run, fix run… steps. It happens when we want to make sure multiple conditions are satisfied at the same time in a single test run.
public class MultiConditions { @Test public void multiConditions() { String firstName = "Gaius"; String lastName = "Caesar"; String helloMessage = composeHelloMessageInEnglish(firstName, lastName); assertThat(helloMessage, containsString("Hello")); assertThat(helloMessage, containsString("Gaius")); assertThat(helloMessage, containsString("CAESAR")); } } Let’s suppose that we introduced bugs in the method composeHelloMessageInEnglish(String,String), where we inserted "Howdy", instead of "Hello" and at the same time, we forgot making family name all upper cases despite its specification of the function.