Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eddarmitage/a93a56e6b7c509add522b32a62965a5b to your computer and use it in GitHub Desktop.
Save eddarmitage/a93a56e6b7c509add522b32a62965a5b to your computer and use it in GitHub Desktop.
I expected the following usage of hasOnlyOneElementSatisfying to pass - perhaps the current implementation would be better described as hasOnlyOneElementAndSatisfies?
import org.junit.Test;
import java.util.Arrays;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
public class HasOnlyOneElementSatisfyingTest {
@Test
public void whatIExpectedToPass() {
List<String> words = Arrays.asList("Woo", "Hoo");
assertThat(words).hasOnlyOneElementSatisfying(w -> assertThat(w).isEqualToIgnoringCase("woo"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment