-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1479 from krmahadevan/krmahadevan-fix-1405
Skip considering main() method
- Loading branch information
Showing
8 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package test.github1405; | ||
|
||
import org.junit.Test; | ||
|
||
public class JUnitTestClassSample { | ||
@Test | ||
public void testMethod() {} | ||
@Test | ||
public static void main(String[] args) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package test.github1405; | ||
|
||
|
||
import org.testng.annotations.Test; | ||
|
||
@Test | ||
public class TestClassSample { | ||
public static void main(String[] args) { | ||
} | ||
|
||
public void testMethod() { | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/test/github1405/TestExclusionOfMainMethod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package test.github1405; | ||
|
||
import org.testng.Assert; | ||
import org.testng.TestNG; | ||
import org.testng.annotations.Test; | ||
import org.testng.xml.XmlSuite; | ||
import test.SimpleBaseTest; | ||
|
||
import java.util.Collections; | ||
|
||
public class TestExclusionOfMainMethod extends SimpleBaseTest { | ||
@Test | ||
public void testMainMethodExclusion() { | ||
TestNG tng = create(TestClassSample.class); | ||
tng.run(); | ||
Assert.assertEquals(tng.getStatus(), 0); | ||
} | ||
|
||
@Test | ||
public void testMainMethodExclusionForJunit() { | ||
XmlSuite xmlSuite = createXmlSuite("suite"); | ||
xmlSuite.setJunit(true); | ||
createXmlTest(xmlSuite, "test", JUnitTestClassSample.class); | ||
TestNG tng = create(xmlSuite); | ||
tng.run(); | ||
Assert.assertEquals(tng.getStatus(), 0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters