Skip to content

Commit 35adc66

Browse files
committed
Mark all but first test @ignore in all exercises
- in journey test, remove @ignores so that test runs exercise all tests. - increase the verbosity of test logging to aide in seeing progress as tests are un@Ignored and solved. - saving scripts used to make changes to all exercises. These are the start of a library of scripts making such changes easier. - make Gradle output more CI-friendly.
1 parent 869781b commit 35adc66

86 files changed

Lines changed: 693 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bin/journey-test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ SCRIPTPATH=$( pushd `dirname $0` > /dev/null && pwd && popd > /dev/null )
33
EXECPATH=$PWD
44
XAPI_PID=""
55

6+
# Makes CI output easier to read
7+
TERM=dumb
8+
69
function on_exit() {
710
echo ">>> on_exit()"
811
if [ "$XAPI_PID" != "" ] ; then
@@ -177,6 +180,7 @@ solve_all_exercises() {
177180
local EXERCISES=`cat config.json | jq '.problems []' --raw-output`
178181
local TOTAL_EXERCISES=`cat config.json | jq '.problems | length'`
179182
local CURRENT_EXERCISE_NUMBER=1
183+
local TEMPFILE="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt"
180184

181185
pushd ${EXERCISM_HOME} >/dev/null
182186
for EXERCISE in $EXERCISES; do
@@ -186,6 +190,9 @@ solve_all_exercises() {
186190
$EXERCISM fetch java $EXERCISE
187191
cp -R -H $REPO_ROOT/exercises/$EXERCISE/src/example/java/* $EXERCISM_HOME/java/$EXERCISE/src/main/java/
188192
pushd $EXERCISM_HOME/java/$EXERCISE/ >/dev/null
193+
for TESTFILE in `find . -name "*Test.java"`; do
194+
sed 's/@Ignore//' $TESTFILE > "$TEMPFILE" && mv "$TEMPFILE" "$TESTFILE"
195+
done
189196
gradle test
190197
popd >/dev/null
191198

config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,10 @@
246246
"ignored": [
247247
"_template",
248248
".gradle",
249-
"docs"
249+
"build",
250+
"docs",
251+
"gradle",
252+
"scripts"
250253
],
251254
"foregone": [
252255
"leap",

exercises/_template/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ repositories {
99
dependencies {
1010
testCompile "junit:junit:4.10"
1111
}
12+
test {
13+
testLogging {
14+
exceptionFormat = 'full'
15+
events = ["passed", "failed", "skipped"]
16+
}
17+
}

exercises/accumulate/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ repositories {
99
dependencies {
1010
testCompile "junit:junit:4.10"
1111
}
12+
test {
13+
testLogging {
14+
exceptionFormat = 'full'
15+
events = ["passed", "failed", "skipped"]
16+
}
17+
}

exercises/accumulate/src/test/java/AccumulateTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.junit.Test;
2+
import org.junit.Ignore;
23

34
import java.util.Arrays;
45
import java.util.LinkedList;
@@ -8,27 +9,31 @@
89

910
public class AccumulateTest {
1011

12+
1113
@Test
1214
public void emptyAccumulateProducesEmptyAccumulation() {
1315
List<Integer> input = new LinkedList<>();
1416
List<Integer> expectedOutput = new LinkedList<>();
1517
assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x));
1618
}
1719

20+
@Ignore
1821
@Test
1922
public void accumulateSquares() {
2023
List<Integer> input = Arrays.asList(1, 2, 3);
2124
List<Integer> expectedOutput = Arrays.asList(1, 4, 9);
2225
assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x));
2326
}
2427

28+
@Ignore
2529
@Test
2630
public void accumulateUpperCases() {
2731
List<String> input = Arrays.asList("hello", "world");
2832
List<String> expectedOutput = Arrays.asList("HELLO", "WORLD");
2933
assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x.toUpperCase()));
3034
}
3135

36+
@Ignore
3237
@Test
3338
public void accumulateReversedStrings() {
3439
List<String> input = Arrays.asList("the quick brown fox etc".split(" "));
@@ -40,6 +45,7 @@ private String reverse(String input) {
4045
return new StringBuilder(input).reverse().toString();
4146
}
4247

48+
@Ignore
4349
@Test
4450
public void accumulateWithinAccumulate() {
4551
List<String> input1 = Arrays.asList("a", "b", "c");

exercises/acronym/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ repositories {
99
dependencies {
1010
testCompile "junit:junit:4.10"
1111
}
12+
test {
13+
testLogging {
14+
exceptionFormat = 'full'
15+
events = ["passed", "failed", "skipped"]
16+
}
17+
}

exercises/acronym/src/test/java/AcronymTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,59 @@
11
import org.junit.Test;
2+
import org.junit.Ignore;
23

34
import static org.junit.Assert.assertEquals;
45

56
public class AcronymTest {
67

8+
79
@Test
810
public void fromTitleCasedPhrases() {
911
final String phrase = "Portable Network Graphics";
1012
final String expected = "PNG";
1113
assertEquals(expected, Acronym.generate(phrase));
1214
}
1315

16+
@Ignore
1417
@Test
1518
public void fromOtherTitleCasedPhrases() {
1619
final String phrase = "Ruby on Rails";
1720
final String expected = "ROR";
1821
assertEquals(expected, Acronym.generate(phrase));
1922
}
2023

24+
@Ignore
2125
@Test
2226
public void fromInconsistentlyCasedPhrases() {
2327
final String phrase = "HyperText Markup Language";
2428
final String expected = "HTML";
2529
assertEquals(expected, Acronym.generate(phrase));
2630
}
2731

32+
@Ignore
2833
@Test
2934
public void fromPhrasesWithPunctuation() {
3035
final String phrase = "First In, First Out";
3136
final String expected = "FIFO";
3237
assertEquals(expected, Acronym.generate(phrase));
3338
}
3439

40+
@Ignore
3541
@Test
3642
public void fromOtherPhrasesWithPunctuation() {
3743
final String phrase = "PHP: Hypertext Preprocessor";
3844
final String expected = "PHP";
3945
assertEquals(expected, Acronym.generate(phrase));
4046
}
4147

48+
@Ignore
4249
@Test
4350
public void fromPhrasesWithPunctuationAndSentenceCasing() {
4451
final String phrase = "Complementary metal-oxide semiconductor";
4552
final String expected = "CMOS";
4653
assertEquals(expected, Acronym.generate(phrase));
4754
}
4855

56+
@Ignore
4957
@Test
5058
public void fromPhraseWithSingleLetterWord() {
5159
final String phrase = "Cat in a Hat";

exercises/allergies/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ repositories {
99
dependencies {
1010
testCompile "junit:junit:4.10"
1111
}
12+
test {
13+
testLogging {
14+
exceptionFormat = 'full'
15+
events = ["passed", "failed", "skipped"]
16+
}
17+
}

exercises/allergies/src/test/java/AllergiesTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.junit.Test;
2+
import org.junit.Ignore;
23

34
import java.util.Arrays;
45
import java.util.List;
@@ -7,6 +8,7 @@
78

89
public class AllergiesTest {
910

11+
1012
@Test
1113
public void noAllergiesMeansNotAllergicToAnything() {
1214
Allergies allergies = new Allergies(0);
@@ -17,76 +19,87 @@ public void noAllergiesMeansNotAllergicToAnything() {
1719
assertEquals(false, allergies.isAllergicTo(Allergen.CATS));
1820
}
1921

22+
@Ignore
2023
@Test
2124
public void allergicToEggs() {
2225
Allergies allergies = new Allergies(1);
2326

2427
assertEquals(true, allergies.isAllergicTo(Allergen.EGGS));
2528
}
2629

30+
@Ignore
2731
@Test
2832
public void allergicToPeanuts() {
2933
Allergies allergies = new Allergies(2);
3034

3135
assertEquals(true, allergies.isAllergicTo(Allergen.PEANUTS));
3236
}
3337

38+
@Ignore
3439
@Test
3540
public void allergicToShellfish() {
3641
Allergies allergies = new Allergies(4);
3742

3843
assertEquals(true, allergies.isAllergicTo(Allergen.SHELLFISH));
3944
}
4045

46+
@Ignore
4147
@Test
4248
public void allergicToStrawberries() {
4349
Allergies allergies = new Allergies(8);
4450

4551
assertEquals(true, allergies.isAllergicTo(Allergen.STRAWBERRIES));
4652
}
4753

54+
@Ignore
4855
@Test
4956
public void allergicToTomatoes() {
5057
Allergies allergies = new Allergies(16);
5158

5259
assertEquals(true, allergies.isAllergicTo(Allergen.TOMATOES));
5360
}
5461

62+
@Ignore
5563
@Test
5664
public void allergicToChocolate() {
5765
Allergies allergies = new Allergies(32);
5866

5967
assertEquals(true, allergies.isAllergicTo(Allergen.CHOCOLATE));
6068
}
6169

70+
@Ignore
6271
@Test
6372
public void allergicToPollen() {
6473
Allergies allergies = new Allergies(64);
6574

6675
assertEquals(true, allergies.isAllergicTo(Allergen.POLLEN));
6776
}
6877

78+
@Ignore
6979
@Test
7080
public void allergicToCats() {
7181
Allergies allergies = new Allergies(128);
7282

7383
assertEquals(true, allergies.isAllergicTo(Allergen.CATS));
7484
}
7585

86+
@Ignore
7687
@Test
7788
public void isAllergicToEggsInAdditionToOtherStuff() {
7889
Allergies allergies = new Allergies(5);
7990

8091
assertEquals(true, allergies.isAllergicTo(Allergen.EGGS));
8192
}
8293

94+
@Ignore
8395
@Test
8496
public void noAllergies() {
8597
Allergies allergies = new Allergies(0);
8698

8799
assertEquals(0, allergies.getList().size());
88100
}
89101

102+
@Ignore
90103
@Test
91104
public void isAllergicToJustEggs() {
92105
Allergies allergies = new Allergies(1);
@@ -95,6 +108,7 @@ public void isAllergicToJustEggs() {
95108
assertEquals(expectedAllergens, allergies.getList());
96109
}
97110

111+
@Ignore
98112
@Test
99113
public void isAllergicToJustPeanuts() {
100114
Allergies allergies = new Allergies(2);
@@ -103,6 +117,7 @@ public void isAllergicToJustPeanuts() {
103117
assertEquals(expectedAllergens, allergies.getList());
104118
}
105119

120+
@Ignore
106121
@Test
107122
public void isAllergicToJustStrawberries() {
108123
Allergies allergies = new Allergies(8);
@@ -111,6 +126,7 @@ public void isAllergicToJustStrawberries() {
111126
assertEquals(expectedAllergens, allergies.getList());
112127
}
113128

129+
@Ignore
114130
@Test
115131
public void isAllergicToEggsAndPeanuts() {
116132
Allergies allergies = new Allergies(3);
@@ -122,6 +138,7 @@ public void isAllergicToEggsAndPeanuts() {
122138
assertEquals(expectedAllergens, allergies.getList());
123139
}
124140

141+
@Ignore
125142
@Test
126143
public void isAllergicToEggsAndShellfish() {
127144
Allergies allergies = new Allergies(5);
@@ -133,6 +150,7 @@ public void isAllergicToEggsAndShellfish() {
133150
assertEquals(expectedAllergens, allergies.getList());
134151
}
135152

153+
@Ignore
136154
@Test
137155
public void isAllergicToLotsOfStuff() {
138156
Allergies allergies = new Allergies(248);
@@ -147,6 +165,7 @@ public void isAllergicToLotsOfStuff() {
147165
assertEquals(expectedAllergens, allergies.getList());
148166
}
149167

168+
@Ignore
150169
@Test
151170
public void isAllergicToEverything() {
152171
Allergies allergies = new Allergies(255);
@@ -164,6 +183,7 @@ public void isAllergicToEverything() {
164183
assertEquals(expectedAllergens, allergies.getList());
165184
}
166185

186+
@Ignore
167187
@Test
168188
public void ignoreNonAllergenScoreParts() {
169189
Allergies allergies = new Allergies(509);

exercises/anagram/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ dependencies {
1010
testCompile "junit:junit:4.10"
1111
testCompile "org.assertj:assertj-core:3.2.0"
1212
}
13+
test {
14+
testLogging {
15+
exceptionFormat = 'full'
16+
events = ["passed", "failed", "skipped"]
17+
}
18+
}

0 commit comments

Comments
 (0)