Merge pull request #9948 from meysam/master

BAEL-4336 @BeforeAll and @AfterAll Methods as a non-static
This commit is contained in:
bfontana 2020-09-10 20:06:11 -03:00 committed by GitHub
commit ed8b77a375
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
package com.baeldung.junit5.nonstatic;
import org.junit.jupiter.api.*;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class BeforeAndAfterAnnotationsUnitTest {
String input;
Long result;
@BeforeAll
public void setup() {
input = "77";
}
@AfterAll
public void teardown() {
input = null;
result = null;
}
@Test
public void whenConvertStringToLong_thenResultShouldBeLong() {
result = Long.valueOf(input);
Assertions.assertEquals(77l, result);
}
}