Added proper conditions for on each execution
This commit is contained in:
@@ -91,12 +91,16 @@ public class StubRunnerExtension implements BeforeAllCallback, AfterAllCallback,
|
||||
|
||||
@Override
|
||||
public void afterEach(ExtensionContext context) throws Exception {
|
||||
if (this.afterAllCalled.get()) {
|
||||
if (extensionOverStaticField()) {
|
||||
return;
|
||||
}
|
||||
after();
|
||||
}
|
||||
|
||||
private boolean extensionOverStaticField() {
|
||||
return this.afterAllCalled.get() || this.beforeAllCalled.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeAll(ExtensionContext extensionContext) {
|
||||
try {
|
||||
@@ -108,7 +112,7 @@ public class StubRunnerExtension implements BeforeAllCallback, AfterAllCallback,
|
||||
|
||||
@Override
|
||||
public void beforeEach(ExtensionContext context) throws Exception {
|
||||
if (this.beforeAllCalled.get()) {
|
||||
if (extensionOverStaticField()) {
|
||||
return;
|
||||
}
|
||||
before();
|
||||
|
||||
Reference in New Issue
Block a user