master
1package ca.mokhan.test;
2
3import Q8.*;
4import java.io.*;
5import java.text.*;
6import java.util.*;
7import junit.framework.Test;
8import junit.framework.TestCase;
9import junit.framework.TestSuite;
10
11public class BadmintonScoringWithStrokeTest extends TestCase {
12 private BadmintonScoringWithStroke subject;
13 private ArrayList<Point> points =
14 new ArrayList<Point>() {
15 {
16 add(new Point(Point.PLAYER1, "a", 1));
17 add(new Point(Point.PLAYER1, "c", 2));
18 add(new Point(Point.PLAYER2, "d", 1));
19 add(new Point(Point.PLAYER2, "e", 2));
20 add(new Point(Point.PLAYER2, "d", 3));
21 add(new Point(Point.PLAYER2, "e", 4));
22 add(new Point(Point.PLAYER2, "d", 5));
23 add(new Point(Point.PLAYER1, "a", 3));
24 add(new Point(Point.PLAYER1, "c", 4));
25 add(new Point(Point.PLAYER2, "e", 6));
26 add(new Point(Point.PLAYER2, "e", 7));
27 add(new Point(Point.PLAYER2, "a", 8));
28 add(new Point(Point.PLAYER2, "d", 9));
29 add(new Point(Point.PLAYER2, "e", 10));
30 add(new Point(Point.PLAYER2, "e", 11));
31 add(new Point(Point.PLAYER2, "e", 12));
32 add(new Point(Point.PLAYER2, "e", 13));
33 add(new Point(Point.PLAYER2, "e", 14));
34 add(new Point(Point.PLAYER2, "e", 15));
35 add(new Point(Point.PLAYER1, "c", 5));
36 add(new Point(Point.PLAYER2, "e", 16));
37 add(new Point(Point.PLAYER2, "e", 17));
38 add(new Point(Point.PLAYER2, "e", 18));
39 add(new Point(Point.PLAYER2, "e", 19));
40 add(new Point(Point.PLAYER2, "e", 20));
41 add(new Point(Point.PLAYER2, "e", 21));
42 }
43 };
44
45 public BadmintonScoringWithStrokeTest(String testName) {
46 super(testName);
47 this.subject = new BadmintonScoringWithStroke(this.points);
48 }
49
50 public static Test suite() {
51 return new TestSuite(BadmintonScoringWithStrokeTest.class);
52 }
53
54 public void test_getMostUsedStrokePlayer1() {
55 assertEquals("smash", subject.getMostUsedStrokePlayer1());
56 }
57
58 public void test_getMostUsedStrokePlayer2() {
59 assertEquals("net-shot", subject.getMostUsedStrokePlayer2());
60 }
61
62 public void test_getPlayer1Points() {
63 assertEquals(5, this.subject.getPlayer1Points());
64 }
65
66 public void test_getPlayer2Points() {
67 assertEquals(21, this.subject.getPlayer2Points());
68 }
69
70 public void test_getContinuousPointsPlayer1() {
71 assertEquals(2, this.subject.getContinuousPointsPlayer1());
72 }
73
74 public void test_getContinuousPointsPlayer2() {
75 assertEquals(9, this.subject.getContinuousPointsPlayer2());
76 }
77}