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
967 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. @Test
  7. public void returnsZeroWhenNoPinIsHit() {
  8. // arrange
  9. String listOfThrows = "-- -- -- -- -- -- -- -- -- --";
  10. int expectedValue = 0;
  11. BownlingCalculator bownlingCalculator = new BownlingCalculator();
  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. BownlingCalculator bownlingCalculator = new BownlingCalculator();
  23. // act
  24. int calculatedResult = bownlingCalculator.evaluate(listOfThrows);
  25. // assert
  26. assertThat("calculated value", calculatedResult, CoreMatchers.equalTo(expectedValue));
  27. }
  28. }