Created
March 5, 2018 13:34
-
-
Save nhojpatrick/5be4e2c4983726a158c86d088f4f1a3d to your computer and use it in GitHub Desktop.
JUnit 5 assertAll as Executable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tld.example; | |
import org.junit.jupiter.api.function.Executable; | |
import org.junit.Test; | |
import static org.junit.jupiter.api.Assertions.assertAll; | |
import static org.junit.jupiter.api.Assertions.assertEquals; | |
public class Example { | |
@Test | |
public void example() { | |
assertAll("parent", | |
() -> assertEquals("1", "2"), | |
() -> nestedAssertAll() | |
); | |
} | |
private Executable nestedAssertAll() { | |
return () -> assertAll("nested", | |
() -> assertEquals("true", "false") | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment