-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Schäfer
committed
Dec 22, 2015
1 parent
66a1603
commit 62aafb6
Showing
3 changed files
with
42 additions
and
5 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
39 changes: 39 additions & 0 deletions
39
...core/src/test/java/com/tngtech/jgiven/impl/params/DefaultCaseDescriptionProviderTest.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,39 @@ | ||
package com.tngtech.jgiven.impl.params; | ||
|
||
import static net.java.quickcheck.generator.CombinedGenerators.lists; | ||
import static net.java.quickcheck.generator.PrimitiveGenerators.strings; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import com.google.common.collect.Lists; | ||
import com.tngtech.java.junit.dataprovider.DataProvider; | ||
import com.tngtech.java.junit.dataprovider.DataProviderRunner; | ||
import com.tngtech.java.junit.dataprovider.DataProviders; | ||
import com.tngtech.java.junit.dataprovider.UseDataProvider; | ||
|
||
import junit.framework.TestCase; | ||
import net.java.quickcheck.junit.SeedInfo; | ||
|
||
@RunWith( value = DataProviderRunner.class ) | ||
public class DefaultCaseDescriptionProviderTest extends TestCase { | ||
|
||
@Rule | ||
public SeedInfo seed = new SeedInfo(); | ||
|
||
@DataProvider | ||
public static Object[][] randomStrings() { | ||
return DataProviders.testForEach( lists( strings(), 20 ).next() ); | ||
} | ||
|
||
@UseDataProvider( "randomStrings" ) | ||
@Test | ||
public void test( String someString ) throws Exception { | ||
seed.restore( -5294091015527388791L ); | ||
DefaultCaseDescriptionProvider provider = new DefaultCaseDescriptionProvider(); | ||
String description = provider.description( "$0", Lists.newArrayList( "someName" ), Lists.newArrayList( someString ) ); | ||
assertThat( description ).isEqualTo( someString ); | ||
} | ||
} |