BAEL-1181 manual (#3104)
* Move data.sql - schema.sql * Implement NameAscendingOrderOfExecutionTest * Implement DefaultOrderOfExecutionTest * Implement JVMOrderOfExecutionTest
This commit is contained in:
parent
9caf73c18e
commit
4d3e730637
|
@ -0,0 +1,33 @@
|
|||
package com.baeldung.junit5;
|
||||
|
||||
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 DefaultOrderOfExecutionTest {
|
||||
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");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.baeldung.junit5;
|
||||
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@FixMethodOrder(MethodSorters.JVM)
|
||||
public class JVMOrderOfExecutionTest {
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.baeldung.junit5;
|
||||
|
||||
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 NameAscendingOrderOfExecutionTest {
|
||||
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");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue