Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions exercises/practice/dominoes/src/test/java/DominoesTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;
Expand All @@ -12,6 +13,7 @@
public class DominoesTest {

@Test
@DisplayName("empty input = empty output")
public void emtpyInputEmptyOutputTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -24,6 +26,7 @@ public void emtpyInputEmptyOutputTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("singleton input = singleton output")
public void singletonInputSingletonOutput() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -37,6 +40,7 @@ public void singletonInputSingletonOutput() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("singleton that can't be chained")
public void singletonCantBeChainedTest() {
Dominoes dominoes = new Dominoes();

Expand All @@ -50,6 +54,7 @@ public void singletonCantBeChainedTest() {

@Disabled("Remove to run test")
@Test
@DisplayName("three elements")
public void threeElementsTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -63,6 +68,7 @@ public void threeElementsTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("can reverse dominoes")
public void canReverseDominoesTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -76,6 +82,7 @@ public void canReverseDominoesTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("can't be chained")
public void cantBeChainedTest() {
Dominoes dominoes = new Dominoes();

Expand All @@ -89,6 +96,7 @@ public void cantBeChainedTest() {

@Disabled("Remove to run test")
@Test
@DisplayName("disconnected - simple")
public void disconnectedSimpleTest() {
Dominoes dominoes = new Dominoes();

Expand All @@ -102,6 +110,7 @@ public void disconnectedSimpleTest() {

@Disabled("Remove to run test")
@Test
@DisplayName("disconnected - double loop")
public void disconnectedDoubleLoopTest() {
Dominoes dominoes = new Dominoes();

Expand All @@ -115,6 +124,7 @@ public void disconnectedDoubleLoopTest() {

@Disabled("Remove to run test")
@Test
@DisplayName("disconnected - single isolated")
public void disconnectedSingleIsolatedTest() {
Dominoes dominoes = new Dominoes();

Expand All @@ -128,6 +138,7 @@ public void disconnectedSingleIsolatedTest() {

@Disabled("Remove to run test")
@Test
@DisplayName("need backtrack")
public void needBacktrackTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -142,6 +153,7 @@ public void needBacktrackTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("separate loops")
public void separateLoopsTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();

Expand All @@ -156,6 +168,7 @@ public void separateLoopsTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("nine elements")
public void nineElementsTest() throws ChainNotFoundException {
Dominoes dominoes = new Dominoes();
Domino[] dominoesArray = {new Domino(1, 2), new Domino(5, 3), new Domino(3, 1),
Expand All @@ -170,6 +183,7 @@ public void nineElementsTest() throws ChainNotFoundException {

@Disabled("Remove to run test")
@Test
@DisplayName("separate three-domino loops")
public void separateThreeDominoLoopsTest() {
Dominoes dominoes = new Dominoes();

Expand Down
5 changes: 5 additions & 0 deletions exercises/practice/etl/src/test/java/EtlTest.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.util.Arrays;
Expand All @@ -14,6 +15,7 @@ public class EtlTest {
private final Etl etl = new Etl();

@Test
@DisplayName("single letter")
public void testTransformOneValue() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
Expand All @@ -34,6 +36,7 @@ public void testTransformOneValue() {

@Disabled("Remove to run test")
@Test
@DisplayName("single score with multiple letters")
public void testTransformMoreValues() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
Expand All @@ -58,6 +61,7 @@ public void testTransformMoreValues() {

@Disabled("Remove to run test")
@Test
@DisplayName("multiple scores with multiple letters")
public void testMoreKeys() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
Expand All @@ -82,6 +86,7 @@ public void testMoreKeys() {

@Disabled("Remove to run test")
@Test
@DisplayName("multiple scores with differing numbers of letters")
public void testFullDataset() {
Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
{
Expand Down
12 changes: 12 additions & 0 deletions exercises/practice/flatten-array/src/test/java/FlattenerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static java.util.Arrays.asList;
Expand All @@ -17,34 +18,39 @@ public void setUp() {
}

@Test
@DisplayName("empty")
public void testEmpty() {
assertThat(flattener.flatten(emptyList()))
.isEmpty();
}

@Disabled("Remove to run test")
@Test
@DisplayName("no nesting")
public void testFlatListIsPreserved() {
assertThat(flattener.flatten(asList(0, '1', "two")))
.containsExactly(0, '1', "two");
}

@Disabled("Remove to run test")
@Test
@DisplayName("flattens a nested array")
public void testNestedList() {
assertThat(flattener.flatten(singletonList(emptyList())))
.isEmpty();
}

@Disabled("Remove to run test")
@Test
@DisplayName("flattens array with just integers present")
public void testASingleLevelOfNestingWithNoNulls() {
assertThat(flattener.flatten(asList(1, asList('2', 3, 4, 5, "six", "7"), 8)))
.containsExactly(1, '2', 3, 4, 5, "six", "7", 8);
}

@Disabled("Remove to run test")
@Test
@DisplayName("5 level nesting")
public void testFiveLevelsOfNestingWithNoNulls() {
assertThat(flattener.flatten(
asList(0,
Expand All @@ -59,6 +65,7 @@ public void testFiveLevelsOfNestingWithNoNulls() {

@Disabled("Remove to run test")
@Test
@DisplayName("6 level nesting")
public void testSixLevelsOfNestingWithNoNulls() {
assertThat(flattener.flatten(
asList("one",
Expand All @@ -71,27 +78,31 @@ public void testSixLevelsOfNestingWithNoNulls() {

@Disabled("Remove to run test")
@Test
@DisplayName("null values are omitted from the final result")
public void testNullValuesAreOmitted() {
assertThat(flattener.flatten(asList("1", "two", null)))
.containsExactly("1", "two");
}

@Disabled("Remove to run test")
@Test
@DisplayName("consecutive null values at the front of the list are omitted from the final result")
public void testConsecutiveNullValuesAtFrontOfListAreOmitted() {
assertThat(flattener.flatten(asList(null, null, 3)))
.containsExactly(3);
}

@Disabled("Remove to run test")
@Test
@DisplayName("consecutive null values in the middle of the list are omitted from the final result")
public void testConsecutiveNullValuesInMiddleOfListAreOmitted() {
assertThat(flattener.flatten(asList(1, null, null, "4")))
.containsExactly(1, "4");
}

@Disabled("Remove to run test")
@Test
@DisplayName("6 level nest list with null values")
public void testSixLevelsOfNestingWithNulls() {
assertThat(flattener.flatten(
asList("0",
Expand All @@ -107,6 +118,7 @@ public void testSixLevelsOfNestingWithNulls() {

@Disabled("Remove to run test")
@Test
@DisplayName("all values in nested list are null")
public void testNestedListsFullOfNullsOnly() {
assertThat(flattener.flatten(
asList(null,
Expand Down