Skip to content

Instantly share code, notes, and snippets.

@beyondxscratch
Created March 5, 2021 17:04
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/dec7d784560690921c9b9a484c07f24f to your computer and use it in GitHub Desktop.
Save beyondxscratch/dec7d784560690921c9b9a484c07f24f to your computer and use it in GitHub Desktop.
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_METHOD;
@TestInstance(PER_METHOD) //valeur par défaut, pas besion de le spécifier
class MyTest {
@BeforeAll
static void avantTousLesTests(){}
@AfterAll
static void apresTousLesTests(){}
@BeforeEach
void avantChaqueTest(){}
@AfterEach
void apresChaqueTest(){}
@Test
void unTest(){}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment