Skip to content

Instantly share code, notes, and snippets.

@beyondxscratch
Created March 11, 2021 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyondxscratch/e86434b91a6d394309138839b9762896 to your computer and use it in GitHub Desktop.
Save beyondxscratch/e86434b91a6d394309138839b9762896 to your computer and use it in GitHub Desktop.
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
public class NestedTests {
@BeforeEach
void globalSetup() {
System.out.println("A");
}
@Test
void test1() {
System.out.println("1");
}
@Test
void test2() {
System.out.println("2");
}
@Nested
class Inside {
@BeforeEach
void localSetup() {
System.out.println("B");
}
@Test
void test3() {
System.out.println("3");
}
@Test
void test4() {
System.out.println("4");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment