package ca.mokhan.test; import Q8.*; import java.io.*; import java.text.*; import java.util.*; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; public class BadmintonScoringWithStrokeTest extends TestCase { private BadmintonScoringWithStroke subject; private ArrayList points = new ArrayList() { { add(new Point(Point.PLAYER1, "a", 1)); add(new Point(Point.PLAYER1, "c", 2)); add(new Point(Point.PLAYER2, "d", 1)); add(new Point(Point.PLAYER2, "e", 2)); add(new Point(Point.PLAYER2, "d", 3)); add(new Point(Point.PLAYER2, "e", 4)); add(new Point(Point.PLAYER2, "d", 5)); add(new Point(Point.PLAYER1, "a", 3)); add(new Point(Point.PLAYER1, "c", 4)); add(new Point(Point.PLAYER2, "e", 6)); add(new Point(Point.PLAYER2, "e", 7)); add(new Point(Point.PLAYER2, "a", 8)); add(new Point(Point.PLAYER2, "d", 9)); add(new Point(Point.PLAYER2, "e", 10)); add(new Point(Point.PLAYER2, "e", 11)); add(new Point(Point.PLAYER2, "e", 12)); add(new Point(Point.PLAYER2, "e", 13)); add(new Point(Point.PLAYER2, "e", 14)); add(new Point(Point.PLAYER2, "e", 15)); add(new Point(Point.PLAYER1, "c", 5)); add(new Point(Point.PLAYER2, "e", 16)); add(new Point(Point.PLAYER2, "e", 17)); add(new Point(Point.PLAYER2, "e", 18)); add(new Point(Point.PLAYER2, "e", 19)); add(new Point(Point.PLAYER2, "e", 20)); add(new Point(Point.PLAYER2, "e", 21)); } }; public BadmintonScoringWithStrokeTest(String testName) { super(testName); this.subject = new BadmintonScoringWithStroke(this.points); } public static Test suite() { return new TestSuite(BadmintonScoringWithStrokeTest.class); } public void test_getMostUsedStrokePlayer1() { assertEquals("smash", subject.getMostUsedStrokePlayer1()); } public void test_getMostUsedStrokePlayer2() { assertEquals("net-shot", subject.getMostUsedStrokePlayer2()); } public void test_getPlayer1Points() { assertEquals(5, this.subject.getPlayer1Points()); } public void test_getPlayer2Points() { assertEquals(21, this.subject.getPlayer2Points()); } public void test_getContinuousPointsPlayer1() { assertEquals(2, this.subject.getContinuousPointsPlayer1()); } public void test_getContinuousPointsPlayer2() { assertEquals(9, this.subject.getContinuousPointsPlayer2()); } }