Skip to content

Commit 1cdbfb8

Browse files
authored
Add @DisplayName to Zipper test methods (#3063)
[no important files changed]
1 parent b8dd622 commit 1cdbfb8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

exercises/practice/zipper/src/test/java/ZipperTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import org.junit.jupiter.api.BeforeEach;
12
import org.junit.jupiter.api.Disabled;
3+
import org.junit.jupiter.api.DisplayName;
24
import org.junit.jupiter.api.Test;
3-
import org.junit.jupiter.api.BeforeEach;
45

56
import static org.assertj.core.api.Assertions.assertThat;
67

@@ -21,54 +22,62 @@ public void setup() {
2122
}
2223

2324
@Test
25+
@DisplayName("data is retained")
2426
public void testToTree() {
2527
assertThat(zipper.toTree()).isEqualTo(binaryTree);
2628
}
2729

2830
@Disabled("Remove to run test")
2931
@Test
32+
@DisplayName("left, right and value")
3033
public void testLeftRightAndValue() {
3134
zipper = binaryTree.getRoot();
3235
assertThat(zipper.left.right.getValue()).isEqualTo(3);
3336
}
3437

3538
@Disabled("Remove to run test")
3639
@Test
40+
@DisplayName("dead end")
3741
public void testDeadEnd() {
3842
zipper = binaryTree.getRoot();
3943
assertThat(zipper.left.left).isNull();
4044
}
4145

4246
@Disabled("Remove to run test")
4347
@Test
48+
@DisplayName("tree from deep focus")
4449
public void testToTreeFromDeepFocus() {
4550
zipper = binaryTree.getRoot();
4651
assertThat(zipper.left.right.toTree()).isEqualTo(binaryTree);
4752
}
4853

4954
@Disabled("Remove to run test")
5055
@Test
56+
@DisplayName("traversing up from top")
5157
public void testTraversingUpFromTop() {
5258
zipper = binaryTree.getRoot();
5359
assertThat(zipper.up).isNull();
5460
}
5561

5662
@Disabled("Remove to run test")
5763
@Test
64+
@DisplayName("left, right, and up")
5865
public void testLeftRightAndUp() {
5966
zipper = binaryTree.getRoot();
6067
assertThat(zipper.left.up.right.up.left.right.getValue()).isEqualTo(3);
6168
}
6269

6370
@Disabled("Remove to run test")
6471
@Test
72+
@DisplayName("test ability to descend multiple levels and return")
6573
public void testAbilityToReturnAfterMultipleLevelDescend() {
6674
zipper = binaryTree.getRoot();
6775
assertThat(zipper.left.right.up.up.getValue()).isEqualTo(1);
6876
}
6977

7078
@Disabled("Remove to run test")
7179
@Test
80+
@DisplayName("set_value")
7281
public void testSetValue() {
7382
zipper = binaryTree.getRoot();
7483
zipper = zipper.left;
@@ -91,6 +100,7 @@ public void testSetValue() {
91100

92101
@Disabled("Remove to run test")
93102
@Test
103+
@DisplayName("set_value after traversing up")
94104
public void testSetValueAfterTraversingUp() {
95105
zipper = binaryTree.getRoot();
96106
zipper = zipper.left.right.up;
@@ -113,6 +123,7 @@ public void testSetValueAfterTraversingUp() {
113123

114124
@Disabled("Remove to run test")
115125
@Test
126+
@DisplayName("set_left with leaf")
116127
public void testSetLeftWithLeaf() {
117128
zipper = binaryTree.getRoot();
118129
zipper = zipper.left;
@@ -138,6 +149,7 @@ public void testSetLeftWithLeaf() {
138149

139150
@Disabled("Remove to run test")
140151
@Test
152+
@DisplayName("set_right with null")
141153
public void testSetRightWithNull() {
142154
zipper = binaryTree.getRoot();
143155
zipper = zipper.left;
@@ -151,6 +163,7 @@ public void testSetRightWithNull() {
151163

152164
@Disabled("Remove to run test")
153165
@Test
166+
@DisplayName("set_right with subtree")
154167
public void testSetRightWithSubtree() {
155168
BinaryTree subtree = new BinaryTree(6);
156169
subtree.getRoot().setLeft(new Zipper(7));
@@ -181,6 +194,7 @@ public void testSetRightWithSubtree() {
181194

182195
@Disabled("Remove to run test")
183196
@Test
197+
@DisplayName("set_value on deep focus")
184198
public void testSetValueOnDeepFocus() {
185199
zipper = binaryTree.getRoot();
186200
zipper = zipper.left.right;
@@ -203,6 +217,7 @@ public void testSetValueOnDeepFocus() {
203217

204218
@Disabled("Remove to run test")
205219
@Test
220+
@DisplayName("different paths to same zipper")
206221
public void differentPathToSameZipper() {
207222
Zipper zipper1 = binaryTree.getRoot().left.up.right;
208223
Zipper zipper2 = binaryTree.getRoot().right;

0 commit comments

Comments
 (0)