Skip to content

Commit 59e9bea

Browse files
authored
Converting Twofew tests to use AssertJ. (exercism#2017)
1 parent 2aec28d commit 59e9bea

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

exercises/practice/two-fer/src/test/java/TwoferTest.java

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import org.junit.Ignore;
33
import org.junit.Test;
44

5-
import static org.junit.Assert.assertEquals;
5+
import static org.assertj.core.api.Assertions.assertThat;
66

77
public class TwoferTest {
88

@@ -15,39 +15,31 @@ public void setup() {
1515

1616
@Test
1717
public void noNameGiven() {
18-
String input = null;
19-
String expected = "One for you, one for me.";
20-
21-
assertEquals(expected, twofer.twofer(input));
18+
assertThat(twofer.twofer(null))
19+
.isEqualTo("One for you, one for me.");
2220
}
2321

2422
@Ignore("Remove to run test")
2523
@Test
2624
public void aNameGiven() {
27-
String input = "Alice";
28-
String expected = "One for Alice, one for me.";
29-
30-
assertEquals(expected, twofer.twofer(input));
25+
assertThat(twofer.twofer("Alice"))
26+
.isEqualTo("One for Alice, one for me.");
3127
}
3228

3329
@Ignore("Remove to run test")
3430
@Test
3531
public void anotherNameGiven() {
36-
String input = "Bob";
37-
String expected = "One for Bob, one for me.";
38-
39-
assertEquals(expected, twofer.twofer(input));
32+
assertThat(twofer.twofer("Bob"))
33+
.isEqualTo("One for Bob, one for me.");
4034
}
4135

4236
/* Track specific */
4337

4438
@Ignore("Remove to run test")
4539
@Test
4640
public void emptyStringIsNotTheSameAsNull() {
47-
String input = "";
48-
String expected = "One for , one for me.";
49-
50-
assertEquals(expected, twofer.twofer(input));
41+
assertThat(twofer.twofer(""))
42+
.isEqualTo("One for , one for me.");
5143
}
52-
44+
5345
}

0 commit comments

Comments
 (0)