BAEL-1862 Move the Junit 5 logic in the right module (#4747)
* BAEL-1862 Move the Junit 5 logic in the right module -Moved Method Orders Tests from tutorails/junit5 project into correct project tutorials/testing-modules/junit-5 -Removed tutorials/junit5 project * Update DefaultOrderOfExecutionTest.java * Update README.md * BAEL-1862 Move the Junit 5 logic in the right module -Renamed *Test to *UnitTest * Update README.md
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
db69306431
commit
3d83de657b
@@ -13,3 +13,5 @@
|
||||
- [@Before vs @BeforeClass vs @BeforeEach vs @BeforeAll](http://www.baeldung.com/junit-before-beforeclass-beforeeach-beforeall)
|
||||
- [Migrating from JUnit 4 to JUnit 5](http://www.baeldung.com/junit-5-migration)
|
||||
- [JUnit5 Programmatic Extension Registration with @RegisterExtension](http://www.baeldung.com/junit-5-registerextension-annotation)
|
||||
- [The Order of Tests in JUnit](http://www.baeldung.com/junit-5-test-order)
|
||||
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.baeldung.methodorders;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.DEFAULT)
|
||||
public class DefaultOrderOfExecutionUnitTest {
|
||||
private static StringBuilder output = new StringBuilder("");
|
||||
|
||||
@Test
|
||||
public void secondTest() {
|
||||
output.append("b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thirdTest() {
|
||||
output.append("c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void firstTest() {
|
||||
output.append("a");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void assertOutput() {
|
||||
assertEquals(output.toString(), "cab");
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.methodorders;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.JVM)
|
||||
public class JVMOrderOfExecutionUnitTest {
|
||||
|
||||
private static StringBuilder output = new StringBuilder("");
|
||||
|
||||
@Test
|
||||
public void secondTest() {
|
||||
output.append("b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thirdTest() {
|
||||
output.append("c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void firstTest() {
|
||||
output.append("a");
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.baeldung.methodorders;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class NameAscendingOrderOfExecutionUnitTest {
|
||||
private static StringBuilder output = new StringBuilder("");
|
||||
|
||||
@Test
|
||||
public void secondTest() {
|
||||
output.append("b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void thirdTest() {
|
||||
output.append("c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void firstTest() {
|
||||
output.append("a");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void assertOutput() {
|
||||
assertEquals(output.toString(), "abc");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user