Skip to content

Commit fb05411

Browse files
authored
Add displaname tree-building (#3064)
1 parent 5366f62 commit fb05411

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

exercises/practice/tree-building/src/test/java/BuildTreeTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
33

44
import org.junit.jupiter.api.Disabled;
5+
import org.junit.jupiter.api.DisplayName;
56
import org.junit.jupiter.api.Test;
67

78
import java.util.ArrayList;
89

910
public class BuildTreeTest {
1011

1112
@Test
13+
@DisplayName("Empty list")
1214
public void testEmptyList() throws InvalidRecordsException {
1315
ArrayList<Record> records = new ArrayList<>();
1416

@@ -18,6 +20,7 @@ public void testEmptyList() throws InvalidRecordsException {
1820

1921
@Disabled("Remove to run test")
2022
@Test
23+
@DisplayName("Single record")
2124
public void testOneRecord() throws InvalidRecordsException {
2225
ArrayList<Record> records = new ArrayList<>();
2326
Record record = new Record(0, 0);
@@ -30,6 +33,7 @@ public void testOneRecord() throws InvalidRecordsException {
3033

3134
@Disabled("Remove to run test")
3235
@Test
36+
@DisplayName("Three records in order")
3337
public void testThreeRecordsInOrder() throws InvalidRecordsException {
3438
ArrayList<Record> records = new ArrayList<>();
3539
records.add(new Record(0, 0));
@@ -48,6 +52,7 @@ public void testThreeRecordsInOrder() throws InvalidRecordsException {
4852

4953
@Disabled("Remove to run test")
5054
@Test
55+
@DisplayName("Three records in reverse order")
5156
public void testThreeRecordsInReverseOrder() throws InvalidRecordsException {
5257
ArrayList<Record> records = new ArrayList<>();
5358
records.add(new Record(2, 0));
@@ -66,6 +71,7 @@ public void testThreeRecordsInReverseOrder() throws InvalidRecordsException {
6671

6772
@Disabled("Remove to run test")
6873
@Test
74+
@DisplayName("More than two children")
6975
public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException {
7076
ArrayList<Record> records = new ArrayList<>();
7177
records.add(new Record(0, 0));
@@ -83,11 +89,11 @@ public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException
8389
assertThat(root.getChildren().get(0).getNodeId()).isEqualTo(1);
8490
assertThat(root.getChildren().get(1).getNodeId()).isEqualTo(2);
8591
assertThat(root.getChildren().get(2).getNodeId()).isEqualTo(3);
86-
8792
}
8893

8994
@Disabled("Remove to run test")
9095
@Test
96+
@DisplayName("Binary tree")
9197
public void testBinaryTree() throws InvalidRecordsException {
9298
ArrayList<Record> records = new ArrayList<>();
9399
records.add(new Record(6, 2));
@@ -119,6 +125,7 @@ public void testBinaryTree() throws InvalidRecordsException {
119125

120126
@Disabled("Remove to run test")
121127
@Test
128+
@DisplayName("Unbalanced tree")
122129
public void testUnbalancedTree() throws InvalidRecordsException {
123130
ArrayList<Record> records = new ArrayList<>();
124131
records.add(new Record(0, 0));
@@ -149,6 +156,7 @@ public void testUnbalancedTree() throws InvalidRecordsException {
149156

150157
@Disabled("Remove to run test")
151158
@Test
159+
@DisplayName("Root has parent")
152160
public void testRootNodeHasParent() {
153161
ArrayList<Record> records = new ArrayList<>();
154162
records.add(new Record(0, 1));
@@ -163,6 +171,7 @@ public void testRootNodeHasParent() {
163171

164172
@Disabled("Remove to run test")
165173
@Test
174+
@DisplayName("No root node")
166175
public void testNoRootNode() {
167176
ArrayList<Record> records = new ArrayList<>();
168177
records.add(new Record(1, 0));
@@ -177,6 +186,7 @@ public void testNoRootNode() {
177186

178187
@Disabled("Remove to run test")
179188
@Test
189+
@DisplayName("Non continuous records")
180190
public void testNonContinuousRecords() {
181191
ArrayList<Record> records = new ArrayList<>();
182192
records.add(new Record(2, 0));
@@ -193,6 +203,7 @@ public void testNonContinuousRecords() {
193203

194204
@Disabled("Remove to run test")
195205
@Test
206+
@DisplayName("Cycle indirectly")
196207
public void testCycleIndirectly() {
197208
ArrayList<Record> records = new ArrayList<>();
198209
records.add(new Record(5, 2));

0 commit comments

Comments
 (0)