-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support rules of type ExternalResource
new integration test with 2 rules and after invocation verification #433
- Loading branch information
Matthias Merdes
authored and
Matthias Merdes
committed
Sep 28, 2016
1 parent
cc25056
commit 4f2df23
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
.../junit/jupiter/engine/vintage/rulesupport/MultipleExternalResourceLegacySupportTests.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,66 @@ | ||
/* | ||
* Copyright 2015-2016 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v1.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.junit.jupiter.engine.vintage.rulesupport; | ||
|
||
import org.junit.Rule; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.rules.ExternalResource; | ||
|
||
@ExtendWith(ExternalResourceLegacySupport.class) | ||
public class MultipleExternalResourceLegacySupportTests { | ||
|
||
private static boolean beforeOfRule1WasExecuted = false; | ||
private static boolean beforeOfRule2WasExecuted = false; | ||
|
||
private static boolean afterOfRule1WasExecuted = false; | ||
private static boolean afterOfRule2WasExecuted = false; | ||
|
||
@Rule | ||
public ExternalResource resource1 = new ExternalResource() { | ||
@Override | ||
protected void before() throws Throwable { | ||
beforeOfRule1WasExecuted = true; | ||
} | ||
|
||
@Override | ||
protected void after() { | ||
afterOfRule1WasExecuted = true; | ||
} | ||
}; | ||
|
||
@Rule | ||
public ExternalResource resource2 = new ExternalResource() { | ||
@Override | ||
protected void before() throws Throwable { | ||
beforeOfRule2WasExecuted = true; | ||
} | ||
|
||
@Override | ||
protected void after() { | ||
afterOfRule2WasExecuted = true; | ||
} | ||
}; | ||
|
||
@Test | ||
void beforeMethodsOfbothRulesWereExecuted() { | ||
assert beforeOfRule1WasExecuted; | ||
// assert beforeOfRule2WasExecuted; | ||
} | ||
|
||
@AfterAll | ||
static void afterMethodsOfBothRulesWereExecuted() { | ||
assert afterOfRule1WasExecuted; | ||
// assert afterOfRule2WasExecuted; | ||
} | ||
|
||
} |