forked from javadev/LeetCode-in-Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeTest.java
More file actions
41 lines (35 loc) · 1.09 KB
/
NodeTest.java
File metadata and controls
41 lines (35 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com_github_leetcode;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Collections;
import org.junit.jupiter.api.Test;
class NodeTest {
@Test
void constructor() {
Node node = new Node();
assertThat(node.val, equalTo(0));
assertThat(node.toString(), equalTo("[]"));
}
@Test
void constructor2() {
Node node = new Node(1);
assertThat(node.val, equalTo(1));
assertThat(node.toString(), equalTo("[]"));
}
@Test
void constructor3() {
Node node = new Node(1, Collections.singletonList(new Node(2)));
assertThat(node.val, equalTo(1));
assertThat(node.toString(), equalTo("[2]"));
}
@Test
void constructor4() {
Node node =
new Node(
1,
Collections.singletonList(
new Node(2, Collections.singletonList(new Node(3)))));
assertThat(node.val, equalTo(1));
assertThat(node.toString(), equalTo("[[3]]"));
}
}