3232import java .util .concurrent .TimeUnit ;
3333import java .util .concurrent .TimeoutException ;
3434import org .junit .Assert ;
35- import org .junit .FixMethodOrder ;
3635import org .junit .jupiter .api .AfterAll ;
3736import org .junit .jupiter .api .Assertions ;
3837import org .junit .jupiter .api .BeforeAll ;
38+ import org .junit .jupiter .api .MethodOrderer ;
39+ import org .junit .jupiter .api .Order ;
3940import org .junit .jupiter .api .Test ;
41+ import org .junit .jupiter .api .TestMethodOrder ;
4042import org .junit .jupiter .api .Timeout ;
4143import org .junit .runner .RunWith ;
4244import org .junit .runners .JUnit4 ;
43- import org .junit .runners .MethodSorters ;
4445
4546@ RunWith (JUnit4 .class )
4647@ Timeout (value = 25 , unit = TimeUnit .MINUTES )
47- @ FixMethodOrder ( MethodSorters . NAME_ASCENDING )
48+ @ TestMethodOrder ( MethodOrderer . OrderAnnotation . class )
4849public class CrudOperationsReservationIT {
4950
5051 private static final String PROJECT_ID = System .getenv ("GOOGLE_CLOUD_PROJECT" );
@@ -84,7 +85,8 @@ public static void cleanup()
8485 }
8586
8687 @ Test
87- public void firstCreateReservationTest ()
88+ @ Order (1 )
89+ public void testCreateReservation ()
8890 throws IOException , ExecutionException , InterruptedException , TimeoutException {
8991 final PrintStream out = System .out ;
9092 ByteArrayOutputStream stdOut = new ByteArrayOutputStream ();
@@ -99,7 +101,8 @@ public void firstCreateReservationTest()
99101 }
100102
101103 @ Test
102- public void secondGetReservationTest ()
104+ @ Order (2 )
105+ public void testGetReservation ()
103106 throws IOException {
104107 Reservation reservation = GetReservation .getReservation (
105108 PROJECT_ID , RESERVATION_NAME , ZONE );
@@ -109,7 +112,8 @@ public void secondGetReservationTest()
109112 }
110113
111114 @ Test
112- public void thirdListReservationTest () throws IOException {
115+ @ Order (3 )
116+ public void testListReservation () throws IOException {
113117 List <Reservation > reservations =
114118 ListReservations .listReservations (PROJECT_ID , ZONE );
115119
@@ -118,6 +122,7 @@ public void thirdListReservationTest() throws IOException {
118122 }
119123
120124 @ Test
125+ @ Order (3 )
121126 public void testUpdateVmsForReservation ()
122127 throws IOException , ExecutionException , InterruptedException , TimeoutException {
123128 int newNumberOfVms = 5 ;
0 commit comments