package test.priority;

import org.testng.Assert;
import org.testng.TestNG;
import org.testng.annotations.Test;
import org.testng.xml.XmlSuite;

import test.SimpleBaseTest;

public class PriorityTest extends SimpleBaseTest {

  private void runTest(Class<?> cls, String first, String second, boolean parallel) {
    TestNG tng = create(cls);
    if (parallel) tng.setParallel(XmlSuite.ParallelMode.METHODS);
    tng.run();
    Assert.assertEquals(BaseSample.m_methods.get(0), first);
    Assert.assertEquals(BaseSample.m_methods.get(1), second);
  }

  @Test(enabled = false, description = "Make sure priorities work in parallel mode")
  public void priorityInParallel1() {
    runTest(WithPrioritySampleTest.class, "first", "second", true /* parallel */);
  }

  @Test(enabled = false, description = "Make sure priorities work in parallel mode")
  public void priorityInParallel2() {
    runTest(WithPrioritySample2Test.class, "second", "first", true /* parallel */);
  }

  @Test(description = "Make sure priorities work in sequential mode")
  public void priorityInSequential1() {
    runTest(WithPrioritySampleTest.class, "first", "second", false /* sequential */);
  }

  @Test(description = "Make sure priorities work in sequential mode")
  public void priorityInSequential2() {
    runTest(WithPrioritySample2Test.class, "second", "first", false /* sequential */);
  }
}

@@ -260,53 +260,43 @@
 ls, 
-String first, String second, boolean parallel
+boolean parallel, String... methods
 ) %7B%0A
@@ -342,16 +342,24 @@
 arallel)
+ %7B%0A     
  tng.set
@@ -399,16 +399,22 @@
 THODS);%0A
+    %7D%0A
     tng.
@@ -428,65 +428,49 @@
     
-Assert.assertEquals(BaseSample.m_methods.get(0), first);%0A
+for (int i=0; i%3Cmethods.length; i++) %7B%0A  
     
@@ -518,20 +518,30 @@
 get(
-1), second);
+i), methods%5Bi%5D);%0A    %7D
 %0A  %7D
@@ -707,35 +707,16 @@
 .class, 
-%22first%22, %22second%22, 
 true /* 
@@ -718,32 +718,51 @@
 e /* parallel */
+, %22first%22, %22second%22
 );%0A  %7D%0A%0A  @Test(
@@ -919,35 +919,16 @@
 .class, 
-%22second%22, %22first%22, 
 true /* 
@@ -934,24 +934,43 @@
  parallel */
+, %22second%22, %22first%22
 );%0A  %7D%0A%0A  @T
@@ -1120,27 +1120,8 @@
 ass,
- %22first%22, %22second%22,
  fal
@@ -1135,24 +1135,43 @@
 equential */
+, %22first%22, %22second%22
 );%0A  %7D%0A%0A  @T
@@ -1322,27 +1322,8 @@
 ass,
- %22second%22, %22first%22,
  fal
@@ -1341,16 +1341,35 @@
 ntial */
+, %22second%22, %22first%22
 );%0A  %7D%0A%7D

Rework PriorityTest