Commit da614def authored by LI Qi's avatar LI Qi
Browse files

add throw declaration

parent 7cb57cf9
......@@ -8,7 +8,7 @@ public class ScoreTable {
public ScoreTable() {}
public void enterPoint(int point) {
public void enterPoint(int point) throws Exception {
getFrameToEnter().enterPoint(point);
updateScoreTable();
}
......
......@@ -9,39 +9,39 @@ public class TestFrame {
public TestFrame() {}
@Test
public void testCase0() {
public void testCase0() throws Exception {
Frame frame = new Frame(0);
frame.enterPoint(7);
Assert.assertArrayEquals(
Assert.assertEquals(
new boolean[] {false, false, false},
new boolean[] {frame.isFinished(), frame.isSpare(), frame.isStrike()});
}
@Test
public void testCase1() {
public void testCase1() throws Exception {
Frame frame = new Frame(0);
frame.enterPoint(10);
Assert.assertArrayEquals(
Assert.assertEquals(
new boolean[] {true, false, true},
new boolean[] {frame.isFinished(), frame.isSpare(), frame.isStrike()});
}
@Test
public void testCase2() {
public void testCase2() throws Exception {
Frame frame = new Frame(0);
frame.enterPoint(7);
frame.enterPoint(3);
Assert.assertArrayEquals(
Assert.assertEquals(
new boolean[] {true, true, false},
new boolean[] {frame.isFinished(), frame.isSpare(), frame.isStrike()});
}
@Test
public void testCase3() {
public void testCase3() throws Exception {
Frame frame = new Frame(0);
frame.enterPoint(7);
frame.enterPoint(0);
Assert.assertArrayEquals(
Assert.assertEquals(
new boolean[] {true, false, false},
new boolean[] {frame.isFinished(), frame.isSpare(), frame.isStrike()});
}
......
package test;
import javax.swing.plaf.metal.MetalBorders.TableHeaderBorder;
import org.junit.Assert;
import org.junit.Test;
......@@ -11,7 +9,7 @@ public class TestScoreTable {
public TestScoreTable() {}
@Test
public void testCase0() {
public void testCase0() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {7,2,10,10,7,3,8};
int[] expected = {7, 9, 19, 39, 60, 66, 82};
......@@ -25,7 +23,7 @@ public class TestScoreTable {
}
@Test
public void testCase1() {
public void testCase1() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10, 3, 6};
int[] expected = {28};
......@@ -37,7 +35,7 @@ public class TestScoreTable {
}
@Test
public void testCase2() {
public void testCase2() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10, 10, 9, 0};
int[] expected = {57};
......@@ -49,7 +47,7 @@ public class TestScoreTable {
}
@Test
public void testCase3() {
public void testCase3() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10, 10, 10, 0, 9};
int[] expected = {78};
......@@ -61,7 +59,7 @@ public class TestScoreTable {
}
@Test
public void testCase4() {
public void testCase4() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10, 10, 4, 2};
int[] expected = {46};
......@@ -73,7 +71,7 @@ public class TestScoreTable {
}
@Test
public void testCase5() {
public void testCase5() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {7, 3, 4, 2};
int[] expected = {20};
......@@ -85,7 +83,7 @@ public class TestScoreTable {
}
@Test
public void testCase6() {
public void testCase6() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10,10,10,10,10,10,10,10,10,8,1};
boolean[] expected = new boolean[points.length];
......@@ -98,11 +96,11 @@ public class TestScoreTable {
}
expected[expected.length - 1] = true;
Assert.assertArrayEquals(expected, actual);
Assert.assertEquals(expected, actual);
}
@Test
public void testCase7() {
public void testCase7() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10,10,10,10,10,10,10,10,10,8,2,10};
boolean[] expected = new boolean[points.length];
......@@ -115,11 +113,11 @@ public class TestScoreTable {
}
expected[expected.length - 1] = true;
Assert.assertArrayEquals(expected, actual);
Assert.assertEquals(expected, actual);
}
@Test
public void testCase8() {
public void testCase8() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10,10,10,10,10,10,10,10,10,10,7,2};
boolean[] expected = new boolean[points.length];
......@@ -132,11 +130,11 @@ public class TestScoreTable {
}
expected[expected.length - 1] = true;
Assert.assertArrayEquals(expected, actual);
Assert.assertEquals(expected, actual);
}
@Test
public void testCase9() {
public void testCase9() throws Exception {
ScoreTable table = new ScoreTable();
int[] points = {10,10,10,10,10,10,10,10,10,8,2,9};
boolean[] expected = new boolean[points.length];
......@@ -149,6 +147,6 @@ public class TestScoreTable {
}
expected[expected.length - 1] = true;
Assert.assertArrayEquals(expected, actual);
Assert.assertEquals(expected, actual);
}
}
......@@ -56,6 +56,6 @@ public class TestSet {
expectedOver[points.length - 1] = true;
Assert.assertArrayEquals(expectedPlayer, actualPlayer);
Assert.assertArrayEquals(expectedOver, actualOver);
Assert.assertEquals(expectedOver, actualOver);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment