forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Honour inheritance when parsing listener factories
Closes testng-team#3095
- Loading branch information
1 parent
554cfa6
commit 69dc232
Showing
11 changed files
with
119 additions
and
44 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/org/testng/internal/listeners/ListenerFactoryContainer.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 org.testng.internal.listeners; | ||
|
||
import org.testng.IExecutionListener; | ||
import org.testng.ITestNGListener; | ||
import org.testng.ITestNGListenerFactory; | ||
|
||
public class ListenerFactoryContainer { | ||
public static class DummyListenerFactory implements ITestNGListenerFactory, IExecutionListener { | ||
@Override | ||
public ITestNGListener createListener(Class<? extends ITestNGListener> listenerClass) { | ||
return this; | ||
} | ||
} | ||
|
||
public static class DummyListenerFactory2 implements ITestNGListenerFactory, IExecutionListener { | ||
@Override | ||
public ITestNGListener createListener(Class<? extends ITestNGListener> listenerClass) { | ||
return this; | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
testng-core/src/test/java/org/testng/internal/listeners/TestClassContainer.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 org.testng.internal.listeners; | ||
|
||
import org.testng.annotations.Listeners; | ||
|
||
public class TestClassContainer { | ||
@Listeners({ | ||
ListenerFactoryContainer.DummyListenerFactory.class, | ||
ListenerFactoryContainer.DummyListenerFactory.class | ||
}) | ||
public static class TestClassWithDuplicateListenerFactories {} | ||
|
||
@Listeners({ | ||
ListenerFactoryContainer.DummyListenerFactory.class, | ||
ListenerFactoryContainer.DummyListenerFactory2.class | ||
}) | ||
public static class TestClassWithMultipleUniqueListenerFactories {} | ||
} |
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
6 changes: 0 additions & 6 deletions
6
...e/src/test/java/org/testng/internal/listeners/TestClassWithMultipleListenerFactories.java
This file was deleted.
Oops, something went wrong.
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
8 changes: 8 additions & 0 deletions
8
testng-core/src/test/java/test/listeners/issue3095/ChildClassSample.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,8 @@ | ||
package test.listeners.issue3095; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
public class ChildClassSample extends SuperClassSample { | ||
@Test | ||
public void childTestMethod() {} | ||
} |
7 changes: 3 additions & 4 deletions
7
...ernal/listeners/DummyListenerFactory.java → .../listeners/issue3095/MyTestNgFactory.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 |
---|---|---|
@@ -1,12 +1,11 @@ | ||
package org.testng.internal.listeners; | ||
package test.listeners.issue3095; | ||
|
||
import org.testng.IExecutionListener; | ||
import org.testng.ITestNGListener; | ||
import org.testng.ITestNGListenerFactory; | ||
|
||
public class DummyListenerFactory implements ITestNGListenerFactory, IExecutionListener { | ||
public class MyTestNgFactory implements ITestNGListener, ITestNGListenerFactory { | ||
@Override | ||
public ITestNGListener createListener(Class<? extends ITestNGListener> listenerClass) { | ||
return this; | ||
return null; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
testng-core/src/test/java/test/listeners/issue3095/SuperClassSample.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,6 @@ | ||
package test.listeners.issue3095; | ||
|
||
import org.testng.annotations.Listeners; | ||
|
||
@Listeners(MyTestNgFactory.class) | ||
public class SuperClassSample {} |