Skip to content

Instantly share code, notes, and snippets.

@nhojpatrick
Created March 5, 2018 13:34
Show Gist options
  • Save nhojpatrick/5be4e2c4983726a158c86d088f4f1a3d to your computer and use it in GitHub Desktop.
Save nhojpatrick/5be4e2c4983726a158c86d088f4f1a3d to your computer and use it in GitHub Desktop.
JUnit 5 assertAll as Executable
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