33
44import org .junit .jupiter .api .Test ;
55import org .junit .jupiter .api .Disabled ;
6+ import org .junit .jupiter .api .DisplayName ;
67
78public class TriangleTest {
89
910 @ Test
11+ @ DisplayName ("equilateral triangle" )
1012 public void equilateralTrianglesHaveEqualSides () throws TriangleException {
1113 Triangle triangle = new Triangle (2 , 2 , 2 );
1214
@@ -15,6 +17,7 @@ public void equilateralTrianglesHaveEqualSides() throws TriangleException {
1517
1618 @ Disabled ("Remove to run test" )
1719 @ Test
20+ @ DisplayName ("any side is unequal" )
1821 public void trianglesWithOneUnequalSideAreNotEquilateral () throws TriangleException {
1922 Triangle triangle = new Triangle (2 , 3 , 2 );
2023
@@ -23,6 +26,7 @@ public void trianglesWithOneUnequalSideAreNotEquilateral() throws TriangleExcept
2326
2427 @ Disabled ("Remove to run test" )
2528 @ Test
29+ @ DisplayName ("no sides are equal" )
2630 public void trianglesWithNoEqualSidesAreNotEquilateral () throws TriangleException {
2731 Triangle triangle = new Triangle (5 , 4 , 6 );
2832
@@ -31,12 +35,14 @@ public void trianglesWithNoEqualSidesAreNotEquilateral() throws TriangleExceptio
3135
3236 @ Disabled ("Remove to run test" )
3337 @ Test
38+ @ DisplayName ("all zero sides is not a triangle" )
3439 public void trianglesWithNoSizeAreIllegal () {
3540 assertThatExceptionOfType (TriangleException .class ).isThrownBy (() -> new Triangle (0 , 0 , 0 ));
3641 }
3742
3843 @ Disabled ("Remove to run test" )
3944 @ Test
45+ @ DisplayName ("sides may be floats" )
4046 public void verySmallTrianglesCanBeEquilateral () throws TriangleException {
4147 Triangle triangle = new Triangle (0.5 , 0.5 , 0.5 );
4248
@@ -45,6 +51,7 @@ public void verySmallTrianglesCanBeEquilateral() throws TriangleException {
4551
4652 @ Disabled ("Remove to run test" )
4753 @ Test
54+ @ DisplayName ("last two sides are equal" )
4855 public void isoscelesTrianglesHaveLastTwoSidesEqual () throws TriangleException {
4956 Triangle triangle = new Triangle (3 , 4 , 4 );
5057
@@ -53,6 +60,7 @@ public void isoscelesTrianglesHaveLastTwoSidesEqual() throws TriangleException {
5360
5461 @ Disabled ("Remove to run test" )
5562 @ Test
63+ @ DisplayName ("first two sides are equal" )
5664 public void isoscelesTrianglesHaveTwoFirstSidesEqual () throws TriangleException {
5765 Triangle triangle = new Triangle (4 , 4 , 3 );
5866
@@ -61,6 +69,7 @@ public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws TriangleException
6169
6270 @ Disabled ("Remove to run test" )
6371 @ Test
72+ @ DisplayName ("first and last sides are equal" )
6473 public void isoscelesTrianglesHaveFirstAndLastSidesEqual () throws TriangleException {
6574 Triangle triangle = new Triangle (4 , 3 , 4 );
6675
@@ -69,6 +78,7 @@ public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws TriangleExcept
6978
7079 @ Disabled ("Remove to run test" )
7180 @ Test
81+ @ DisplayName ("equilateral triangles are also isosceles" )
7282 public void equilateralTrianglesAreAlsoIsosceles () throws TriangleException {
7383 Triangle triangle = new Triangle (4 , 4 , 4 );
7484
@@ -77,6 +87,7 @@ public void equilateralTrianglesAreAlsoIsosceles() throws TriangleException {
7787
7888 @ Disabled ("Remove to run test" )
7989 @ Test
90+ @ DisplayName ("no sides are equal" )
8091 public void noSidesAreEqualCantBeIsoceles () throws TriangleException {
8192 Triangle triangle = new Triangle (2 , 3 , 4 );
8293
@@ -85,24 +96,28 @@ public void noSidesAreEqualCantBeIsoceles() throws TriangleException {
8596
8697 @ Disabled ("Remove to run test" )
8798 @ Test
99+ @ DisplayName ("first triangle inequality violation" )
88100 public void firstTriangleInequalityViolation () {
89101 assertThatExceptionOfType (TriangleException .class ).isThrownBy (() -> new Triangle (1 , 1 , 3 ));
90102 }
91103
92104 @ Disabled ("Remove to run test" )
93105 @ Test
106+ @ DisplayName ("second triangle inequality violation" )
94107 public void secondTriangleInequalityViolation () {
95108 assertThatExceptionOfType (TriangleException .class ).isThrownBy (() -> new Triangle (1 , 3 , 1 ));
96109 }
97110
98111 @ Disabled ("Remove to run test" )
99112 @ Test
113+ @ DisplayName ("third triangle inequality violation" )
100114 public void thirdTriangleInequalityViolation () {
101115 assertThatExceptionOfType (TriangleException .class ).isThrownBy (() -> new Triangle (3 , 1 , 1 ));
102116 }
103117
104118 @ Disabled ("Remove to run test" )
105119 @ Test
120+ @ DisplayName ("sides may be floats" )
106121 public void verySmallTrianglesCanBeIsosceles () throws TriangleException {
107122 Triangle triangle = new Triangle (0.5 , 0.4 , 0.5 );
108123
@@ -111,6 +126,7 @@ public void verySmallTrianglesCanBeIsosceles() throws TriangleException {
111126
112127 @ Disabled ("Remove to run test" )
113128 @ Test
129+ @ DisplayName ("no sides are equal" )
114130 public void scaleneTrianglesHaveNoEqualSides () throws TriangleException {
115131 Triangle triangle = new Triangle (5 , 4 , 6 );
116132
@@ -119,6 +135,7 @@ public void scaleneTrianglesHaveNoEqualSides() throws TriangleException {
119135
120136 @ Disabled ("Remove to run test" )
121137 @ Test
138+ @ DisplayName ("all sides are equal" )
122139 public void allSidesEqualAreNotScalene () throws TriangleException {
123140 Triangle triangle = new Triangle (4 , 4 , 4 );
124141
@@ -127,6 +144,7 @@ public void allSidesEqualAreNotScalene() throws TriangleException {
127144
128145 @ Disabled ("Remove to run test" )
129146 @ Test
147+ @ DisplayName ("first and second sides are equal" )
130148 public void twoSidesEqualAreNotScalene () throws TriangleException {
131149 Triangle triangle = new Triangle (4 , 4 , 3 );
132150
@@ -135,6 +153,7 @@ public void twoSidesEqualAreNotScalene() throws TriangleException {
135153
136154 @ Disabled ("Remove to run test" )
137155 @ Test
156+ @ DisplayName ("first and third sides are equal" )
138157 public void firstAndThirdSidesAreEqualAreNotScalene () throws TriangleException {
139158 Triangle triangle = new Triangle (3 , 4 , 3 );
140159
@@ -143,6 +162,7 @@ public void firstAndThirdSidesAreEqualAreNotScalene() throws TriangleException {
143162
144163 @ Disabled ("Remove to run test" )
145164 @ Test
165+ @ DisplayName ("second and third sides are equal" )
146166 public void secondAndThirdSidesAreEqualAreNotScalene () throws TriangleException {
147167 Triangle triangle = new Triangle (4 , 3 , 3 );
148168
@@ -151,12 +171,14 @@ public void secondAndThirdSidesAreEqualAreNotScalene() throws TriangleException
151171
152172 @ Disabled ("Remove to run test" )
153173 @ Test
174+ @ DisplayName ("may not violate triangle inequality" )
154175 public void mayNotViolateTriangleInequality () {
155176 assertThatExceptionOfType (TriangleException .class ).isThrownBy (() -> new Triangle (7 , 3 , 2 ));
156177 }
157178
158179 @ Disabled ("Remove to run test" )
159180 @ Test
181+ @ DisplayName ("sides may be floats" )
160182 public void verySmallTrianglesCanBeScalene () throws TriangleException {
161183 Triangle triangle = new Triangle (0.5 , 0.4 , 0.6 );
162184
0 commit comments