diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..878052f --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..bc14d94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9dbe251 --- /dev/null +++ b/pom.xml @@ -0,0 +1,33 @@ + + + 4.0.0 + + org.example + bowling-kata + 1.0-SNAPSHOT + + + 14 + 14 + 5.8.1 + 1.8.1 + + + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit.jupiter.version} + test + + + + \ No newline at end of file diff --git a/src/main/java/BowlingGameCalculator.java b/src/main/java/BowlingGameCalculator.java new file mode 100644 index 0000000..84210ca --- /dev/null +++ b/src/main/java/BowlingGameCalculator.java @@ -0,0 +1,5 @@ +public class BowlingGameCalculator { + public int score(String playerResult) { + return 0; + } +} diff --git a/src/test/java/BowlingCalculatorTest.java b/src/test/java/BowlingCalculatorTest.java new file mode 100644 index 0000000..edaedda --- /dev/null +++ b/src/test/java/BowlingCalculatorTest.java @@ -0,0 +1,30 @@ +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.aggregator.AggregateWith; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.CsvFileSource; +import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.MethodSource; + +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class BowlingCalculatorTest { + + @ParameterizedTest(name = "[{index}] {0} scores {2}") + @MethodSource("playerResults") + void test(String testName, String playerResult, int expectedScore) { + BowlingGameCalculator bgc = new BowlingGameCalculator(); + + int calculatedScore = bgc.score(playerResult); + + assertEquals(expectedScore, calculatedScore, String.format("%s: %s", testName, playerResult)); + } + + private static Stream playerResults() { + return Stream.of(Arguments.of("worst game", "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", 0)); // 16x 0 + } +} diff --git a/target/classes/BowlingGameCalculator.class b/target/classes/BowlingGameCalculator.class new file mode 100644 index 0000000..069817a Binary files /dev/null and b/target/classes/BowlingGameCalculator.class differ diff --git a/target/test-classes/BowlingCalculatorTest.class b/target/test-classes/BowlingCalculatorTest.class new file mode 100644 index 0000000..82ff973 Binary files /dev/null and b/target/test-classes/BowlingCalculatorTest.class differ