Skip to content

Commit 7d1b12e

Browse files
committed
Restore move from FEST Assert to AssertJ
1 parent f5bc0da commit 7d1b12e

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎anagram/build.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ repositories {
88

99
dependencies {
1010
testCompile "junit:junit:4.10"
11+
testCompile "org.assertj:assertj-core:3.2.0"
1112
}
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,76 @@
1-
import static org.hamcrest.CoreMatchers.*;
2-
import static org.junit.matchers.JUnitMatchers.*;
3-
import static org.junit.Assert.*;
1+
import static org.assertj.core.api.Assertions.assertThat;
42

5-
import java.util.*;
6-
import org.junit.*;
3+
import java.util.Arrays;
4+
import java.util.List;
5+
import org.junit.Test;
76

87
public class AnagramTest {
98

109
@Test
1110
public void testNoMatches() {
1211
Anagram detector = new Anagram("diaper");
13-
assertTrue(detector.match(Arrays.asList("hello", "world", "zombies", "pants")).isEmpty());
12+
assertThat(detector.match(Arrays.asList("hello", "world", "zombies", "pants"))).isEmpty();
1413
}
1514

1615
@Test
1716
public void testSimpleAnagram() {
1817
Anagram detector = new Anagram("ant");
1918
List<String> anagram = detector.match(Arrays.asList("tan", "stand", "at"));
20-
assertThat(anagram, hasItems("tan"));
19+
assertThat(anagram).containsExactly("tan");
2120
}
2221

2322
@Test
2423
public void testDetectMultipleAnagrams() {
2524
Anagram detector = new Anagram("master");
2625
List<String> anagrams = detector.match(Arrays.asList("stream", "pigeon", "maters"));
27-
assertThat(anagrams, hasItems("maters", "stream"));
26+
assertThat(anagrams).contains("maters", "stream");
2827
}
2928

3029
@Test
3130
public void testDoesNotConfuseDifferentDuplicates() {
3231
Anagram detector = new Anagram("galea");
3332
List<String> anagrams = detector.match(Arrays.asList("eagle"));
34-
assertTrue(anagrams.isEmpty());
33+
assertThat(anagrams).isEmpty();
3534
}
3635

3736
@Test
3837
public void testIdenticalWordIsNotAnagram() {
3938
Anagram detector = new Anagram("corn");
4039
List<String> anagrams = detector.match(Arrays.asList("corn", "dark", "Corn", "rank", "CORN", "cron", "park"));
41-
assertEquals(anagrams, Arrays.asList("cron"));
40+
assertThat(anagrams).containsExactly("cron");
4241
}
4342

4443
@Test
4544
public void testEliminateAnagramsWithSameChecksum() {
4645
Anagram detector = new Anagram("mass");
47-
assertTrue(detector.match(Arrays.asList("last")).isEmpty());
46+
assertThat(detector.match(Arrays.asList("last")).isEmpty());
4847
}
4948

5049
@Test
5150
public void testEliminateAnagramSubsets() {
5251
Anagram detector = new Anagram("good");
53-
assertTrue(detector.match(Arrays.asList("dog", "goody")).isEmpty());
52+
assertThat(detector.match(Arrays.asList("dog", "goody"))).isEmpty();
5453
}
5554

5655
@Test
5756
public void testDetectAnagrams() {
5857
Anagram detector = new Anagram("listen");
5958
List<String> anagrams = detector.match(Arrays.asList("enlists", "google", "inlets", "banana"));
60-
assertThat(anagrams, hasItems("inlets"));
59+
assertThat(anagrams).contains("inlets");
6160
}
6261

6362
@Test
6463
public void testMultipleAnagrams() {
6564
Anagram detector = new Anagram("allergy");
6665
List<String> anagrams = detector.match(Arrays.asList("gallery", "ballerina", "regally", "clergy", "largely", "leading"));
67-
assertThat(anagrams, hasItems("gallery", "largely", "regally"));
66+
assertThat(anagrams).contains("gallery", "largely", "regally");
6867
}
6968

7069
@Test
7170
public void testAnagramsAreCaseInsensitive() {
7271
Anagram detector = new Anagram("Orchestra");
7372
List<String> anagrams = detector.match(Arrays.asList("cashregister", "Carthorse", "radishes"));
74-
assertThat(anagrams, hasItems("Carthorse"));
73+
assertThat(anagrams).contains("Carthorse");
7574
}
7675

7776
}

‎etl/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repositories {
88

99
dependencies {
1010
testCompile "junit:junit:4.10"
11-
testCompile "org.easytesting:fest-assert-core:2.0M10"
11+
testCompile "org.assertj:assertj-core:3.2.0"
1212
testCompile "com.google.guava:guava:16+"
1313
}

‎grade-school/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repositories {
88

99
dependencies {
1010
testCompile "junit:junit:4.10"
11-
testCompile "org.easytesting:fest-assert-core:2.0M10"
11+
testCompile "org.assertj:assertj-core:3.2.0"
1212
}
1313

‎meetup/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ repositories {
99
dependencies {
1010
compile "joda-time:joda-time:2.3+"
1111
testCompile "junit:junit:4.10"
12-
testCompile "org.easytesting:fest-assert-core:2.0M10"
12+
testCompile "org.assertj:assertj-core:3.2.0"
1313
}

‎nucleotide-count/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repositories {
88

99
dependencies {
1010
testCompile "junit:junit:4.10"
11-
testCompile "org.easytesting:fest-assert-core:2.0M10"
11+
testCompile "org.assertj:assertj-core:3.2.0"
1212
}
1313

0 commit comments

Comments
 (0)