package test.dependent;

import org.testng.annotations.ExpectedExceptions;
import org.testng.annotations.Test;

import test.BaseTest;

public class DependentTest extends BaseTest {

  @Test
  public void simpleSkip() {
    addClass("test.dependent.SampleDependent1");
    run();
    String[] passed = {
    };
    String[] failed = {
      "fail"
    };
    String[] skipped = {
      "shouldBeSkipped"
    };
    verifyTests("Passed", passed, getPassedTests());
    verifyTests("Failed", failed, getFailedTests());
    verifyTests("Skipped", skipped, getSkippedTests());
  }

  @Test
  public void dependentMethods() {
    addClass("test.dependent.SampleDependentMethods");
    run();
    String[] passed = {
        "oneA", "oneB", "secondA", "thirdA", "canBeRunAnytime"
    };
    String[] failed = {
    };
    String[] skipped = {
    };
    verifyTests("Passed", passed, getPassedTests());
    verifyTests("Failed", failed, getFailedTests());
    verifyTests("Skipped", skipped, getSkippedTests());
  }

  @Test
  public void dependentMethodsWithSkip() {
    addClass("test.dependent.SampleDependentMethods4");
    run();
    String[] passed = {
        "step1",
    };
    String[] failed = {
        "step2",
    };
    String[] skipped = {
        "step3"
    };
    verifyTests("Passed", passed, getPassedTests());
    verifyTests("Failed", failed, getFailedTests());
    verifyTests("Skipped", skipped, getSkippedTests());
  }

  @Test
  @ExpectedExceptions({ org.testng.TestNGException.class })
  public void dependentMethodsWithNonExistentMethod() {
    addClass("test.dependent.SampleDependentMethods5");
    run();
    String[] passed = {
        "step1", "step2"
    };
    String[] failed = {
    };
    String[] skipped = {
    };
    verifyTests("Passed", passed, getPassedTests());
    verifyTests("Failed", failed, getFailedTests());
    verifyTests("Skipped", skipped, getSkippedTests());
  }

  @Test(expectedExceptions = org.testng.TestNGException.class )
  public void dependentMethodsWithCycle() {
    addClass("test.dependent.SampleDependentMethods6");
    run();
  }

  @Test(expectedExceptions = org.testng.TestNGException.class )
  public void dependentGroupsWithCycle() {
    addClass("test.dependent.SampleDependentMethods7");
    run();
  }

  @Test
  public void multipleSkips() {
    addClass(MultipleDependentSampleTest.class.getName());
    run();
    String[] passed = {
        "init",
    };
    String[] failed = {
        "fail",
    };
    String[] skipped = {
        "skip1", "skip2"
    };
    verifyTests("Passed", passed, getPassedTests());
    verifyTests("Failed", failed, getFailedTests());
    verifyTests("Skipped", skipped, getSkippedTests());
  }
} // DependentTest



@@ -229,41 +229,40 @@
 ass(
-%22test.dependent.SampleDependent1%22
+SampleDependent1.class.getName()
 );%0A 
@@ -625,32 +625,16 @@
 ddClass(
-%22test.dependent.
 SampleDe
@@ -647,17 +647,32 @@
 tMethods
-%22
+.class.getName()
 );%0A    r
@@ -1065,32 +1065,16 @@
 ddClass(
-%22test.dependent.
 SampleDe
@@ -1088,17 +1088,32 @@
 Methods4
-%22
+.class.getName()
 );%0A    r
@@ -1566,32 +1566,16 @@
 ddClass(
-%22test.dependent.
 SampleDe
@@ -1589,17 +1589,32 @@
 Methods5
-%22
+.class.getName()
 );%0A    r
@@ -2026,32 +2026,16 @@
 ddClass(
-%22test.dependent.
 SampleDe
@@ -2049,17 +2049,32 @@
 Methods6
-%22
+.class.getName()
 );%0A    r

Test refactoring.