Browse Source

variant 2

parameterized_Tests
Thomas Papendieck 4 years ago
parent
commit
1a01dd963d
  1. 23
      src/test/java/de/edu/hsfulda/ccip/tdd/purefunction/parameterized/BowlingCalculatorParameterized_2_CsvTest.java

23
src/test/java/de/edu/hsfulda/ccip/tdd/purefunction/parameterized/BowlingCalculatorParameterized_2_CsvTest.java

@ -0,0 +1,23 @@
package de.edu.hsfulda.ccip.tdd.purefunction.parameterized;
import static org.junit.Assert.assertThat;
import org.hamcrest.CoreMatchers;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import de.edu.hsfulda.ccip.tdd.purefunction.BowlingCalculator;
public class BowlingCalculatorParameterized_2_CsvTest {
@CsvSource({ //
"worst game , -- -- -- -- -- -- -- -- -- --, 0",
"incomplete frames, -1 23 -4 5- -6 -7 8- 9- -- --, 45" //
})
@ParameterizedTest(name = "#{index} - game type {0}")
void testStreamSouceMulti(String gameType, String rolls, int expectedResult) {
int score = new BowlingCalculator().score(rolls);
assertThat(rolls, score, CoreMatchers.equalTo(expectedResult));
}
}
Loading…
Cancel
Save