Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 13 additions & 0 deletions exercises/practice/transpose/src/test/java/TransposeTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import static org.assertj.core.api.Assertions.assertThat;

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

Expand All @@ -13,12 +14,14 @@ public void setup() {
}

@Test
@DisplayName("empty string")
public void emptyString() {
assertThat(transpose.transpose("")).isEqualTo("");
}

@Disabled("Remove to run test")
@Test
@DisplayName("two characters in a row")
public void twoCharactersInARow() {
assertThat(transpose.transpose("A1"))
.isEqualTo(
Expand All @@ -28,6 +31,7 @@ public void twoCharactersInARow() {

@Disabled("Remove to run test")
@Test
@DisplayName("two characters in a column")
public void twoCharactersInAColumn() {
assertThat(
transpose.transpose(
Expand All @@ -38,6 +42,7 @@ public void twoCharactersInAColumn() {

@Disabled("Remove to run test")
@Test
@DisplayName("simple")
public void simple() {
assertThat(
transpose.transpose(
Expand All @@ -51,6 +56,7 @@ public void simple() {

@Disabled("Remove to run test")
@Test
@DisplayName("single line")
public void singleLine() {
assertThat(transpose.transpose("Single line."))
.isEqualTo(
Expand All @@ -70,6 +76,7 @@ public void singleLine() {

@Disabled("Remove to run test")
@Test
@DisplayName("first line longer than second line")
public void firstLineLongerThanSecondLine() {
assertThat(
transpose.transpose(
Expand All @@ -96,6 +103,7 @@ public void firstLineLongerThanSecondLine() {

@Disabled("Remove to run test")
@Test
@DisplayName("second line longer than first line")
public void secondLineLongerThanFirstLine() {
assertThat(
transpose.transpose(
Expand All @@ -122,6 +130,7 @@ public void secondLineLongerThanFirstLine() {

@Disabled("Remove to run test")
@Test
@DisplayName("mixed line length")
public void mixedLineLength() {
assertThat(
transpose.transpose(
Expand Down Expand Up @@ -151,6 +160,7 @@ public void mixedLineLength() {

@Disabled("Remove to run test")
@Test
@DisplayName("")
public void square() {
assertThat(
transpose.transpose(
Expand All @@ -169,6 +179,7 @@ public void square() {

@Disabled("Remove to run test")
@Test
@DisplayName("square")
public void rectangle() {
assertThat(
transpose.transpose(
Expand All @@ -189,6 +200,7 @@ public void rectangle() {

@Disabled("Remove to run test")
@Test
@DisplayName("rectangle")
public void triangle() {
assertThat(
transpose.transpose(
Expand All @@ -209,6 +221,7 @@ public void triangle() {

@Disabled("Remove to run test")
@Test
@DisplayName("jagged triangle")
public void jaggedTriangle() {
assertThat(
transpose.transpose(
Expand Down
22 changes: 22 additions & 0 deletions exercises/practice/triangle/src/test/java/TriangleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

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

public class TriangleTest {

@Test
@DisplayName("equilateral triangle")
public void equilateralTrianglesHaveEqualSides() throws TriangleException {
Triangle triangle = new Triangle(2, 2, 2);

Expand All @@ -15,6 +17,7 @@ public void equilateralTrianglesHaveEqualSides() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("any side is unequal")
public void trianglesWithOneUnequalSideAreNotEquilateral() throws TriangleException {
Triangle triangle = new Triangle(2, 3, 2);

Expand All @@ -23,6 +26,7 @@ public void trianglesWithOneUnequalSideAreNotEquilateral() throws TriangleExcept

@Disabled("Remove to run test")
@Test
@DisplayName("no sides are equal")
public void trianglesWithNoEqualSidesAreNotEquilateral() throws TriangleException {
Triangle triangle = new Triangle(5, 4, 6);

Expand All @@ -31,12 +35,14 @@ public void trianglesWithNoEqualSidesAreNotEquilateral() throws TriangleExceptio

@Disabled("Remove to run test")
@Test
@DisplayName("all zero sides is not a triangle")
public void trianglesWithNoSizeAreIllegal() {
assertThatExceptionOfType(TriangleException.class).isThrownBy(() -> new Triangle(0, 0, 0));
}

@Disabled("Remove to run test")
@Test
@DisplayName("sides may be floats")
public void verySmallTrianglesCanBeEquilateral() throws TriangleException {
Triangle triangle = new Triangle(0.5, 0.5, 0.5);

Expand All @@ -45,6 +51,7 @@ public void verySmallTrianglesCanBeEquilateral() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("last two sides are equal")
public void isoscelesTrianglesHaveLastTwoSidesEqual() throws TriangleException {
Triangle triangle = new Triangle(3, 4, 4);

Expand All @@ -53,6 +60,7 @@ public void isoscelesTrianglesHaveLastTwoSidesEqual() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("first two sides are equal")
public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws TriangleException {
Triangle triangle = new Triangle(4, 4, 3);

Expand All @@ -61,6 +69,7 @@ public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws TriangleException

@Disabled("Remove to run test")
@Test
@DisplayName("first and last sides are equal")
public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws TriangleException {
Triangle triangle = new Triangle(4, 3, 4);

Expand All @@ -69,6 +78,7 @@ public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws TriangleExcept

@Disabled("Remove to run test")
@Test
@DisplayName("equilateral triangles are also isosceles")
public void equilateralTrianglesAreAlsoIsosceles() throws TriangleException {
Triangle triangle = new Triangle(4, 4, 4);

Expand All @@ -77,6 +87,7 @@ public void equilateralTrianglesAreAlsoIsosceles() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("no sides are equal")
public void noSidesAreEqualCantBeIsoceles() throws TriangleException {
Triangle triangle = new Triangle(2, 3, 4);

Expand All @@ -85,24 +96,28 @@ public void noSidesAreEqualCantBeIsoceles() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("first triangle inequality violation")
public void firstTriangleInequalityViolation() {
assertThatExceptionOfType(TriangleException.class).isThrownBy(() -> new Triangle(1, 1, 3));
}

@Disabled("Remove to run test")
@Test
@DisplayName("second triangle inequality violation")
public void secondTriangleInequalityViolation() {
assertThatExceptionOfType(TriangleException.class).isThrownBy(() -> new Triangle(1, 3, 1));
}

@Disabled("Remove to run test")
@Test
@DisplayName("third triangle inequality violation")
public void thirdTriangleInequalityViolation() {
assertThatExceptionOfType(TriangleException.class).isThrownBy(() -> new Triangle(3, 1, 1));
}

@Disabled("Remove to run test")
@Test
@DisplayName("sides may be floats")
public void verySmallTrianglesCanBeIsosceles() throws TriangleException {
Triangle triangle = new Triangle(0.5, 0.4, 0.5);

Expand All @@ -111,6 +126,7 @@ public void verySmallTrianglesCanBeIsosceles() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("")
public void scaleneTrianglesHaveNoEqualSides() throws TriangleException {
Triangle triangle = new Triangle(5, 4, 6);

Expand All @@ -119,6 +135,7 @@ public void scaleneTrianglesHaveNoEqualSides() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("no sides are equal")
public void allSidesEqualAreNotScalene() throws TriangleException {
Triangle triangle = new Triangle(4, 4, 4);

Expand All @@ -127,6 +144,7 @@ public void allSidesEqualAreNotScalene() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("first and second sides are equal")
public void twoSidesEqualAreNotScalene() throws TriangleException {
Triangle triangle = new Triangle(4, 4, 3);

Expand All @@ -135,6 +153,7 @@ public void twoSidesEqualAreNotScalene() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("first and third sides are equal")
public void firstAndThirdSidesAreEqualAreNotScalene() throws TriangleException {
Triangle triangle = new Triangle(3, 4, 3);

Expand All @@ -143,6 +162,7 @@ public void firstAndThirdSidesAreEqualAreNotScalene() throws TriangleException {

@Disabled("Remove to run test")
@Test
@DisplayName("second and third sides are equal")
public void secondAndThirdSidesAreEqualAreNotScalene() throws TriangleException {
Triangle triangle = new Triangle(4, 3, 3);

Expand All @@ -151,12 +171,14 @@ public void secondAndThirdSidesAreEqualAreNotScalene() throws TriangleException

@Disabled("Remove to run test")
@Test
@DisplayName("may not violate triangle inequality")
public void mayNotViolateTriangleInequality() {
assertThatExceptionOfType(TriangleException.class).isThrownBy(() -> new Triangle(7, 3, 2));
}

@Disabled("Remove to run test")
@Test
@DisplayName("sides may be floats")
public void verySmallTrianglesCanBeScalene() throws TriangleException {
Triangle triangle = new Triangle(0.5, 0.4, 0.6);

Expand Down
16 changes: 16 additions & 0 deletions exercises/practice/twelve-days/src/test/java/TwelveDaysTest.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 org.assertj.core.api.Assertions.assertThat;
Expand All @@ -13,6 +14,7 @@ public void setup() {
}

@Test
@DisplayName("first day a partridge in a pear tree")
public void testVerseOne() {
String expectedVerseOne = "On the first day of Christmas my true love gave to me: " +
"a Partridge in a Pear Tree.\n";
Expand All @@ -21,6 +23,7 @@ public void testVerseOne() {

@Disabled("Remove to run test")
@Test
@DisplayName("second day two turtle doves")
public void testVerseTwo() {
String expectedVerseTwo = "On the second day of Christmas my true love gave to me: two Turtle Doves, " +
"and a Partridge in a Pear Tree.\n";
Expand All @@ -29,6 +32,7 @@ public void testVerseTwo() {

@Disabled("Remove to run test")
@Test
@DisplayName("third day three french hens")
public void testVerseThree() {
String expectedVerseThree = "On the third day of Christmas my true love gave to me: three French Hens, " +
"two Turtle Doves, and a Partridge in a Pear Tree.\n";
Expand All @@ -37,6 +41,7 @@ public void testVerseThree() {

@Disabled("Remove to run test")
@Test
@DisplayName("fourth day four calling birds")
public void testVerseFour() {
String expectedVerseFour = "On the fourth day of Christmas my true love gave to me: four Calling Birds, " +
"three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n";
Expand All @@ -45,6 +50,7 @@ public void testVerseFour() {

@Disabled("Remove to run test")
@Test
@DisplayName("fifth day five gold rings")
public void testVerseFive() {
String expectedVerseFive = "On the fifth day of Christmas my true love gave to me: five Gold Rings, " +
"four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n";
Expand All @@ -53,6 +59,7 @@ public void testVerseFive() {

@Disabled("Remove to run test")
@Test
@DisplayName("sixth day six geese-a-laying")
public void testVerseSix() {
String expectedVerseSix = "On the sixth day of Christmas my true love gave to me: six Geese-a-Laying, " +
"five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, " +
Expand All @@ -62,6 +69,7 @@ public void testVerseSix() {

@Disabled("Remove to run test")
@Test
@DisplayName("seventh day seven swans-a-swimming")
public void testVerseSeven() {
String expectedVerseSeven = "On the seventh day of Christmas my true love gave to me: " +
"seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, " +
Expand All @@ -71,6 +79,7 @@ public void testVerseSeven() {

@Disabled("Remove to run test")
@Test
@DisplayName("eighth day eight maids-a-milking")
public void testVerseEight() {
String expectedVerseEight = "On the eighth day of Christmas my true love gave to me: eight Maids-a-Milking," +
" seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, " +
Expand All @@ -80,6 +89,7 @@ public void testVerseEight() {

@Disabled("Remove to run test")
@Test
@DisplayName("ninth day nine ladies dancing")
public void testVerseNine() {
String expectedVerseNine = "On the ninth day of Christmas my true love gave to me: nine Ladies Dancing, " +
"eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, " +
Expand All @@ -89,6 +99,7 @@ public void testVerseNine() {

@Disabled("Remove to run test")
@Test
@DisplayName("tenth day ten lords-a-leaping")
public void testVerseTen() {
String expectedVerseTen = "On the tenth day of Christmas my true love gave to me: ten Lords-a-Leaping, " +
"nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, " +
Expand All @@ -99,6 +110,7 @@ public void testVerseTen() {

@Disabled("Remove to run test")
@Test
@DisplayName("eleventh day eleven pipers piping")
public void testVerseEleven() {
String expectedVerseEleven = "On the eleventh day of Christmas my true love gave to me: " +
"eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, " +
Expand All @@ -109,6 +121,7 @@ public void testVerseEleven() {

@Disabled("Remove to run test")
@Test
@DisplayName("twelfth day twelve drummers drumming")
public void testVerseTwelve() {
String expectedVerseTwelve = "On the twelfth day of Christmas my true love gave to me: " +
"twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, " +
Expand All @@ -119,6 +132,7 @@ public void testVerseTwelve() {

@Disabled("Remove to run test")
@Test
@DisplayName("recites first three verses of the song")
public void testFirstThreeVerses() {
String expectedVersesOneToThree = "On the first day of Christmas my true love gave to me: " +
"a Partridge in a Pear Tree.\n\n" +
Expand All @@ -131,6 +145,7 @@ public void testFirstThreeVerses() {

@Disabled("Remove to run test")
@Test
@DisplayName("recites three verses from the middle of the song")
public void testFourthToSixthVerses() {
String expectedVersesFourToSix = "On the fourth day of Christmas my true love gave to me: " +
"four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n" +
Expand All @@ -143,6 +158,7 @@ public void testFourthToSixthVerses() {

@Disabled("Remove to run test")
@Test
@DisplayName("recites the whole song")
public void testSingWholeSong() {
String expectedSong = "On the first day of Christmas my true love gave to me: a Partridge in a Pear Tree.\n" +
"\n" +
Expand Down