Created
May 28, 2019 08:24
-
-
Save sahoosunilkumar/c10cf00fd68eee58c5111fc499979018 to your computer and use it in GitHub Desktop.
Unit Testing for JUnit Annotations
This file contains 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 com.sunilsahoo.unittesting.test; | |
import org.junit.jupiter.api.*; | |
class AnnotationTest { | |
@BeforeAll | |
static void setup(){ | |
System.out.println("@BeforeAll executed"); | |
} | |
@BeforeEach | |
void setupThis(){ | |
System.out.println("@BeforeEach executed"); | |
} | |
@Tag("DEV") | |
@Test | |
void testOne() | |
{ | |
System.out.println("======TEST ONE EXECUTED======="); | |
Assertions.assertEquals( "env" , "env"); | |
} | |
@Tag("PROD") | |
@Disabled | |
@Test | |
void testTwo() | |
{ | |
System.out.println("======TEST TWO EXECUTED======="); | |
Assertions.assertEquals( "env" , "env"); | |
} | |
@Test | |
void testThree() | |
{ | |
System.out.println("======TEST THREE EXECUTED======="); | |
Assertions.assertEquals( "env" , "env"); | |
} | |
@AfterEach | |
void tearThis(){ | |
System.out.println("@AfterEach executed"); | |
} | |
@AfterAll | |
static void tear(){ | |
System.out.println("@AfterAll executed"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment