-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue106-double-execution'
* issue106-double-execution: filter synthetic methods for dataprovider tests (#106) add test cases for implementing test cases for junit-jupiter* (#106)
- Loading branch information
Showing
13 changed files
with
161 additions
and
8 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
8 changes: 8 additions & 0 deletions
8
.../integTest/java/com/tngtech/test/junit/dataprovider/override/AcceptanceTestInterface.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 com.tngtech.test.junit.dataprovider.override; | ||
|
||
public interface AcceptanceTestInterface<T> { | ||
|
||
void testToBeImplemented(); | ||
|
||
void testToBeImplemented(T value); | ||
} |
40 changes: 40 additions & 0 deletions
40
...tegTest/java/com/tngtech/test/junit/dataprovider/override/ImplementingAcceptanceTest.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,40 @@ | ||
package com.tngtech.test.junit.dataprovider.override; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
|
||
import com.tngtech.junit.dataprovider.DataProvider; | ||
import com.tngtech.junit.dataprovider.UseDataProvider; | ||
|
||
class ImplementingAcceptanceTest implements AcceptanceTestInterface<Integer> { | ||
|
||
private static final AtomicInteger noOfNormalTestsCalls = new AtomicInteger(0); | ||
private static final AtomicInteger noOfDataProviderTestsCalls = new AtomicInteger(0); | ||
|
||
@DataProvider | ||
public static Object[][] dataProviderToBeImplemented() { | ||
// @formatter:off | ||
return new Object[][] { | ||
{ 1 }, | ||
{ 2 }, | ||
}; | ||
// @formatter:on | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testToBeImplemented() { | ||
assertThat(1).isEqualTo(noOfNormalTestsCalls.incrementAndGet()); | ||
} | ||
|
||
@ParameterizedTest | ||
@UseDataProvider | ||
@Override | ||
public void testToBeImplemented(Integer value) { | ||
assertThat(value).isEqualTo(noOfDataProviderTestsCalls.incrementAndGet()); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
.../integTest/java/com/tngtech/test/junit/dataprovider/override/AcceptanceTestInterface.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 com.tngtech.test.junit.dataprovider.override; | ||
|
||
public interface AcceptanceTestInterface<T> { | ||
|
||
void testToBeImplemented(); | ||
|
||
void testToBeImplemented(T value); | ||
} |
43 changes: 43 additions & 0 deletions
43
...tegTest/java/com/tngtech/test/junit/dataprovider/override/ImplementingAcceptanceTest.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,43 @@ | ||
package com.tngtech.test.junit.dataprovider.override; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestTemplate; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import com.tngtech.junit.dataprovider.DataProvider; | ||
import com.tngtech.junit.dataprovider.UseDataProvider; | ||
import com.tngtech.junit.dataprovider.UseDataProviderExtension; | ||
|
||
@ExtendWith(UseDataProviderExtension.class) | ||
class ImplementingAcceptanceTest implements AcceptanceTestInterface<Integer> { | ||
|
||
private static final AtomicInteger noOfNormalTestsCalls = new AtomicInteger(0); | ||
private static final AtomicInteger noOfDataProviderTestsCalls = new AtomicInteger(0); | ||
|
||
@DataProvider | ||
public static Object[][] dataProviderToBeImplemented() { | ||
// @formatter:off | ||
return new Object[][] { | ||
{ 1 }, | ||
{ 2 }, | ||
}; | ||
// @formatter:on | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testToBeImplemented() { | ||
assertThat(1).isEqualTo(noOfNormalTestsCalls.incrementAndGet()); | ||
} | ||
|
||
@TestTemplate | ||
@UseDataProvider | ||
@Override | ||
public void testToBeImplemented(Integer value) { | ||
assertThat(value).isEqualTo(noOfDataProviderTestsCalls.incrementAndGet()); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
...om/tngtech/test/java/junit/dataprovider/override/DataProviderAcceptanceTestInterface.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 com.tngtech.test.java.junit.dataprovider.override; | ||
|
||
public interface DataProviderAcceptanceTestInterface<T> { | ||
|
||
void testToBeImplemented(); | ||
|
||
void testToBeImplemented(T value); | ||
} |
42 changes: 42 additions & 0 deletions
42
...tngtech/test/java/junit/dataprovider/override/DataProviderImplementingAcceptanceTest.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,42 @@ | ||
package com.tngtech.test.java.junit.dataprovider.override; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.tngtech.java.junit.dataprovider.DataProvider; | ||
import com.tngtech.java.junit.dataprovider.DataProviderRunner; | ||
import com.tngtech.java.junit.dataprovider.UseDataProvider; | ||
|
||
@RunWith(DataProviderRunner.class) | ||
public class DataProviderImplementingAcceptanceTest implements DataProviderAcceptanceTestInterface<Integer> { | ||
|
||
private static final AtomicInteger noOfNormalTestsCalls = new AtomicInteger(0); | ||
private static final AtomicInteger noOfDataProviderTestsCalls = new AtomicInteger(0); | ||
|
||
@DataProvider | ||
public static Object[][] dataProviderToBeImplemented() { | ||
// @formatter:off | ||
return new Object[][] { | ||
{ 1 }, | ||
{ 2 }, | ||
}; | ||
// @formatter:on | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testToBeImplemented() { | ||
assertThat(1).isEqualTo(noOfNormalTestsCalls.incrementAndGet()); | ||
} | ||
|
||
@Test | ||
@UseDataProvider | ||
@Override | ||
public void testToBeImplemented(Integer value) { | ||
assertThat(value).isEqualTo(noOfDataProviderTestsCalls.incrementAndGet()); | ||
} | ||
} |
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