소스 검색

triangle: specify the type of exceptions

MichaelSpets 9 년 전
부모
커밋
73183466c4
1개의 변경된 파일15개의 추가작업 그리고 15개의 파일을 삭제
  1. 15
    15
      exercises/triangle/src/test/java/TriangleTest.java

+ 15
- 15
exercises/triangle/src/test/java/TriangleTest.java 파일 보기

11
     public final ExpectedException thrown = ExpectedException.none();
11
     public final ExpectedException thrown = ExpectedException.none();
12
 
12
 
13
     @Test
13
     @Test
14
-    public void equilateralTriangleHaveEqualSides() throws Exception {
14
+    public void equilateralTriangleHaveEqualSides() throws TriangleException {
15
         Triangle triangle = new Triangle(2, 2, 2);
15
         Triangle triangle = new Triangle(2, 2, 2);
16
 
16
 
17
         assertEquals(TriangleKind.EQUILATERAL, triangle.getKind());
17
         assertEquals(TriangleKind.EQUILATERAL, triangle.getKind());
19
 
19
 
20
     @Ignore
20
     @Ignore
21
     @Test
21
     @Test
22
-    public void largerEquilateralTrianglesAlsoHaveEqualSides() throws Exception {
22
+    public void largerEquilateralTrianglesAlsoHaveEqualSides() throws TriangleException {
23
         Triangle triangle = new Triangle(10, 10, 10);
23
         Triangle triangle = new Triangle(10, 10, 10);
24
 
24
 
25
         assertEquals(TriangleKind.EQUILATERAL, triangle.getKind());
25
         assertEquals(TriangleKind.EQUILATERAL, triangle.getKind());
27
 
27
 
28
     @Ignore
28
     @Ignore
29
     @Test
29
     @Test
30
-    public void isoscelesTrianglesHaveLastTwoSidesEqual() throws Exception {
30
+    public void isoscelesTrianglesHaveLastTwoSidesEqual() throws TriangleException {
31
         Triangle triangle = new Triangle(3, 4, 4);
31
         Triangle triangle = new Triangle(3, 4, 4);
32
 
32
 
33
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
33
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
35
 
35
 
36
     @Ignore
36
     @Ignore
37
     @Test
37
     @Test
38
-    public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws Exception {
38
+    public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws TriangleException {
39
         Triangle triangle = new Triangle(4, 3, 4);
39
         Triangle triangle = new Triangle(4, 3, 4);
40
 
40
 
41
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
41
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
43
 
43
 
44
     @Ignore
44
     @Ignore
45
     @Test
45
     @Test
46
-    public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws Exception {
46
+    public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws TriangleException {
47
         Triangle triangle = new Triangle(4, 4, 3);
47
         Triangle triangle = new Triangle(4, 4, 3);
48
 
48
 
49
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
49
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
51
 
51
 
52
     @Ignore
52
     @Ignore
53
     @Test
53
     @Test
54
-    public void isoscelesTrianglesHaveInFactExactlyTwoSidesEqual() throws Exception {
54
+    public void isoscelesTrianglesHaveInFactExactlyTwoSidesEqual() throws TriangleException {
55
         Triangle triangle = new Triangle(10, 10, 2);
55
         Triangle triangle = new Triangle(10, 10, 2);
56
 
56
 
57
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
57
         assertEquals(TriangleKind.ISOSCELES, triangle.getKind());
59
 
59
 
60
     @Ignore
60
     @Ignore
61
     @Test
61
     @Test
62
-    public void scaleneTrianglesHaveNoEqualSides() throws Exception {
62
+    public void scaleneTrianglesHaveNoEqualSides() throws TriangleException {
63
         Triangle triangle = new Triangle(3, 4, 5);
63
         Triangle triangle = new Triangle(3, 4, 5);
64
 
64
 
65
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
65
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
67
 
67
 
68
     @Ignore
68
     @Ignore
69
     @Test
69
     @Test
70
-    public void scaleneTrianglesHaveNoEqualSidesAtLargerScaleEither() throws Exception {
70
+    public void scaleneTrianglesHaveNoEqualSidesAtLargerScaleEither() throws TriangleException {
71
         Triangle triangle = new Triangle(10, 11, 12);
71
         Triangle triangle = new Triangle(10, 11, 12);
72
 
72
 
73
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
73
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
75
 
75
 
76
     @Ignore
76
     @Ignore
77
     @Test
77
     @Test
78
-    public void scaleneTrianglesHaveNoEqualSidesInDescendingOrderEither() throws Exception {
78
+    public void scaleneTrianglesHaveNoEqualSidesInDescendingOrderEither() throws TriangleException {
79
         Triangle triangle = new Triangle(5, 4, 2);
79
         Triangle triangle = new Triangle(5, 4, 2);
80
 
80
 
81
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
81
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
83
 
83
 
84
     @Ignore
84
     @Ignore
85
     @Test
85
     @Test
86
-    public void verySmallTrianglesAreLegal() throws Exception {
86
+    public void verySmallTrianglesAreLegal() throws TriangleException {
87
         Triangle triangle = new Triangle(0.4, 0.6, 0.3);
87
         Triangle triangle = new Triangle(0.4, 0.6, 0.3);
88
 
88
 
89
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
89
         assertEquals(TriangleKind.SCALENE, triangle.getKind());
91
 
91
 
92
     @Ignore
92
     @Ignore
93
     @Test
93
     @Test
94
-    public void trianglesWithNoSizeAreIllegal() throws Exception {
94
+    public void trianglesWithNoSizeAreIllegal() throws TriangleException {
95
         thrown.expect(TriangleException.class);
95
         thrown.expect(TriangleException.class);
96
         new Triangle(0, 0, 0);
96
         new Triangle(0, 0, 0);
97
     }
97
     }
98
 
98
 
99
     @Ignore
99
     @Ignore
100
     @Test
100
     @Test
101
-    public void trianglesWithNegativeSidesAreIllegal() throws Exception {
101
+    public void trianglesWithNegativeSidesAreIllegal() throws TriangleException {
102
         thrown.expect(TriangleException.class);
102
         thrown.expect(TriangleException.class);
103
         new Triangle(3, 4, -5);
103
         new Triangle(3, 4, -5);
104
     }
104
     }
105
 
105
 
106
     @Ignore
106
     @Ignore
107
     @Test
107
     @Test
108
-    public void trianglesViolatingTriangleInequalityAreIllegal() throws Exception {
108
+    public void trianglesViolatingTriangleInequalityAreIllegal() throws TriangleException {
109
         thrown.expect(TriangleException.class);
109
         thrown.expect(TriangleException.class);
110
         new Triangle(1, 1, 3);
110
         new Triangle(1, 1, 3);
111
     }
111
     }
112
 
112
 
113
     @Ignore
113
     @Ignore
114
     @Test
114
     @Test
115
-    public void trianglesViolatingTriangleInequalityAreIllegal2() throws Exception {
115
+    public void trianglesViolatingTriangleInequalityAreIllegal2() throws TriangleException {
116
         thrown.expect(TriangleException.class);
116
         thrown.expect(TriangleException.class);
117
         new Triangle(2, 4, 2);
117
         new Triangle(2, 4, 2);
118
     }
118
     }
119
 
119
 
120
     @Ignore
120
     @Ignore
121
     @Test
121
     @Test
122
-    public void trianglesViolatingTriangleInequalityAreIllegal3() throws Exception {
122
+    public void trianglesViolatingTriangleInequalityAreIllegal3() throws TriangleException {
123
         thrown.expect(TriangleException.class);
123
         thrown.expect(TriangleException.class);
124
         new Triangle(7, 3, 2);
124
         new Triangle(7, 3, 2);
125
     }
125
     }