You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
913 B

  1. package de.edu.hsfulda.ciip.tdd;
  2. import static org.junit.Assert.*;
  3. import org.hamcrest.CoreMatchers;
  4. import org.junit.Test;
  5. public class BowlingCalculatorTest {
  6. private final BownlingCalculator bownlingCalculator = new BownlingCalculator();
  7. @Test
  8. public void returnsZeroWhenNoPinIsHit() {
  9. // arrange
  10. String listOfThrows = "-- -- -- -- -- -- -- -- -- --";
  11. int expectedValue = 0;
  12. // act
  13. int calculatedResult = bownlingCalculator.evaluate(listOfThrows);
  14. // assert
  15. assertThat("calculated value", calculatedResult, CoreMatchers.equalTo(expectedValue));
  16. }
  17. @Test
  18. public void createsSumOfAllIncompleteFrames() {
  19. // arrange
  20. String listOfThrows = "11 22 33 44 54 63 72 81 -9 --";
  21. int expectedValue = 65;
  22. // act
  23. int calculatedResult = bownlingCalculator.evaluate(listOfThrows);
  24. // assert
  25. assertThat("calculated value", calculatedResult, CoreMatchers.equalTo(expectedValue));
  26. }
  27. }