-
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.
Streamline dependencies for configurations
Closes #3000
- Loading branch information
1 parent
2e5d8bf
commit b5be6ca
Showing
6 changed files
with
125 additions
and
7 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
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/java/test/configuration/issue3000/MyBaseTestSample.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,21 @@ | ||
package test.configuration.issue3000; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
|
||
abstract class MyBaseTestSample implements MyInterface { | ||
protected Object dependency; | ||
|
||
public void setDependency(Object ignored) {} | ||
|
||
@BeforeClass | ||
public void setupDependency() { | ||
dependency = new Object(); | ||
} | ||
|
||
// Had to add the "__" to this method (This is not how it looks like in the sample provided | ||
// in the GitHub issue). A combination of the fully qualified method names is what causes | ||
// this method to be first found in the configuration methods by TestNG and so it causes | ||
// the issue. | ||
@BeforeClass(dependsOnMethods = "setupDependency") | ||
public void __setupAdditionalDependency_() {} | ||
} |
10 changes: 10 additions & 0 deletions
10
testng-core/src/test/java/test/configuration/issue3000/MyInterface.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,10 @@ | ||
package test.configuration.issue3000; | ||
|
||
@SuppressWarnings("unused") | ||
interface MyInterface { | ||
void setDependency(Object dependency); | ||
|
||
default Object getDependency() { | ||
return null; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
testng-core/src/test/java/test/configuration/issue3000/TestClassSample.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,17 @@ | ||
package test.configuration.issue3000; | ||
|
||
import static org.testng.Assert.assertNotNull; | ||
|
||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
public class TestClassSample extends MyBaseTestSample { | ||
|
||
@BeforeClass | ||
public void beforeClass() { | ||
assertNotNull(dependency); | ||
} | ||
|
||
@Test | ||
public void test() {} | ||
} |