1
1
import org .junit .jupiter .api .Disabled ;
2
+ import org .junit .jupiter .api .DisplayName ;
2
3
import org .junit .jupiter .api .Test ;
3
4
4
5
import java .util .List ;
9
10
public class PovTest {
10
11
11
12
@ Test
13
+ @ DisplayName ("Results in the same tree if the input tree is a singleton" )
12
14
public void testFromPovGivenSingletonTree () {
13
15
Tree tree = Tree .of ("x" );
14
16
Tree expected = Tree .of ("x" );
@@ -17,6 +19,7 @@ public void testFromPovGivenSingletonTree() {
17
19
18
20
@ Disabled ("Remove to run test" )
19
21
@ Test
22
+ @ DisplayName ("Can reroot a tree with a parent and one sibling" )
20
23
public void testFromPovGivenTreeWithParentAndOneSibling () {
21
24
Tree tree = Tree .of ("parent" ,
22
25
List .of (Tree .of ("x" ),
@@ -30,6 +33,7 @@ public void testFromPovGivenTreeWithParentAndOneSibling() {
30
33
31
34
@ Disabled ("Remove to run test" )
32
35
@ Test
36
+ @ DisplayName ("Can reroot a tree with a parent and many siblings" )
33
37
public void testFromPovGivenTreeWithParentAndManySibling () {
34
38
Tree tree = Tree .of ("parent" ,
35
39
List .of (Tree .of ("x" ),
@@ -48,6 +52,7 @@ public void testFromPovGivenTreeWithParentAndManySibling() {
48
52
49
53
@ Disabled ("Remove to run test" )
50
54
@ Test
55
+ @ DisplayName ("an reroot a tree with new root deeply nested in the tree" )
51
56
public void testFromPovGivenTreeWithNewRootDeeplyNested () {
52
57
Tree tree = Tree .of ("level-0" ,
53
58
List .of (Tree .of ("level-1" ,
@@ -66,6 +71,7 @@ public void testFromPovGivenTreeWithNewRootDeeplyNested() {
66
71
67
72
@ Disabled ("Remove to run test" )
68
73
@ Test
74
+ @ DisplayName ("Moves children of the new root to same level as former parent" )
69
75
public void testFromPovGivenMovesChildrenOfNewRootToSameLevelAsFormerParent () {
70
76
Tree tree = Tree .of ("parent" ,
71
77
List .of (Tree .of ("x" ,
@@ -82,6 +88,7 @@ public void testFromPovGivenMovesChildrenOfNewRootToSameLevelAsFormerParent() {
82
88
83
89
@ Disabled ("Remove to run test" )
84
90
@ Test
91
+ @ DisplayName ("Can reroot a complex tree with cousins" )
85
92
public void testFromPovGivenComplexTreeWithCousins () {
86
93
Tree tree = Tree .of ("grandparent" ,
87
94
List .of (Tree .of ("parent" ,
@@ -110,6 +117,7 @@ public void testFromPovGivenComplexTreeWithCousins() {
110
117
111
118
@ Disabled ("Remove to run test" )
112
119
@ Test
120
+ @ DisplayName ("Errors if target does not exist in a singleton tree" )
113
121
public void testFromPovGivenNonExistentTargetInSingletonTree () {
114
122
Tree tree = Tree .of ("x" );
115
123
assertThatExceptionOfType (UnsupportedOperationException .class )
@@ -119,6 +127,7 @@ public void testFromPovGivenNonExistentTargetInSingletonTree() {
119
127
120
128
@ Disabled ("Remove to run test" )
121
129
@ Test
130
+ @ DisplayName ("Errors if target does not exist in a larger tree" )
122
131
public void testFromPovGivenNonExistentTargetInLargeTree () {
123
132
Tree tree = Tree .of ("parent" ,
124
133
List .of (Tree .of ("x" ,
@@ -134,6 +143,7 @@ public void testFromPovGivenNonExistentTargetInLargeTree() {
134
143
135
144
@ Disabled ("Remove to run test" )
136
145
@ Test
146
+ @ DisplayName ("Can find path to parent" )
137
147
public void testPathToCanFindPathToParent () {
138
148
Tree tree = Tree .of ("parent" ,
139
149
List .of (Tree .of ("x" ),
@@ -158,6 +168,7 @@ public void testPathToCanFindPathToSibling() {
158
168
159
169
@ Disabled ("Remove to run test" )
160
170
@ Test
171
+ @ DisplayName ("Can find path to cousin" )
161
172
public void testPathToCanFindPathToCousin () {
162
173
Tree tree = Tree .of ("grandparent" ,
163
174
List .of (Tree .of ("parent" ,
@@ -176,6 +187,7 @@ public void testPathToCanFindPathToCousin() {
176
187
177
188
@ Disabled ("Remove to run test" )
178
189
@ Test
190
+ @ DisplayName ("Can find path not involving root" )
179
191
public void testPathToCanFindPathNotEnvolvingRoot () {
180
192
Tree tree = Tree .of ("grandparent" ,
181
193
List .of (Tree .of ("parent" ,
@@ -189,6 +201,7 @@ public void testPathToCanFindPathNotEnvolvingRoot() {
189
201
190
202
@ Disabled ("Remove to run test" )
191
203
@ Test
204
+ @ DisplayName ("Can find path from nodes other than x" )
192
205
public void testPathToCanFindPathFromNodesOtherThanX () {
193
206
Tree tree = Tree .of ("parent" ,
194
207
List .of (Tree .of ("a" ),
@@ -202,6 +215,7 @@ public void testPathToCanFindPathFromNodesOtherThanX() {
202
215
203
216
@ Disabled ("Remove to run test" )
204
217
@ Test
218
+ @ DisplayName ("Errors if destination does not exist" )
205
219
public void testPathWhenDestinationDoesNotExist () {
206
220
Tree tree = Tree .of ("parent" ,
207
221
List .of (Tree .of ("x" ,
@@ -217,6 +231,7 @@ public void testPathWhenDestinationDoesNotExist() {
217
231
218
232
@ Disabled ("Remove to run test" )
219
233
@ Test
234
+ @ DisplayName ("Errors if source does not exist" )
220
235
public void testPathWhenSourceDoesNotExist () {
221
236
Tree tree = Tree .of ("parent" ,
222
237
List .of (Tree .of ("x" ,
0 commit comments