Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;

public class BuildTreeTest {

@Test
@DisplayName("Empty list")
public void testEmptyList() throws InvalidRecordsException {
ArrayList<Record> records = new ArrayList<>();

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

@Disabled("Remove to run test")
@Test
@DisplayName("Single record")
public void testOneRecord() throws InvalidRecordsException {
ArrayList<Record> records = new ArrayList<>();
Record record = new Record(0, 0);
Expand All @@ -30,6 +33,7 @@ public void testOneRecord() throws InvalidRecordsException {

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

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

@Disabled("Remove to run test")
@Test
@DisplayName("More than two children")
public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException {
ArrayList<Record> records = new ArrayList<>();
records.add(new Record(0, 0));
Expand All @@ -83,11 +89,11 @@ public void testRecordsWithMoreThanTwoChildren() throws InvalidRecordsException
assertThat(root.getChildren().get(0).getNodeId()).isEqualTo(1);
assertThat(root.getChildren().get(1).getNodeId()).isEqualTo(2);
assertThat(root.getChildren().get(2).getNodeId()).isEqualTo(3);

}

@Disabled("Remove to run test")
@Test
@DisplayName("Binary tree")
public void testBinaryTree() throws InvalidRecordsException {
ArrayList<Record> records = new ArrayList<>();
records.add(new Record(6, 2));
Expand Down Expand Up @@ -119,6 +125,7 @@ public void testBinaryTree() throws InvalidRecordsException {

@Disabled("Remove to run test")
@Test
@DisplayName("Unbalanced tree")
public void testUnbalancedTree() throws InvalidRecordsException {
ArrayList<Record> records = new ArrayList<>();
records.add(new Record(0, 0));
Expand Down Expand Up @@ -149,6 +156,7 @@ public void testUnbalancedTree() throws InvalidRecordsException {

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

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

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

@Disabled("Remove to run test")
@Test
@DisplayName("Cycle indirectly")
public void testCycleIndirectly() {
ArrayList<Record> records = new ArrayList<>();
records.add(new Record(5, 2));
Expand Down