Skip to content

Commit

Permalink
add the empty unit test for the two-fer of the java track
Browse files Browse the repository at this point in the history
  • Loading branch information
xinri committed Nov 9, 2019
1 parent ed42b07 commit c3731cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion exercises/two-fer/.meta/src/reference/java/Twofer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class Twofer {
String twofer(String name) {
return "One for " + (name != null ? name : "you") + ", one for me.";
final String nameToDisplay = name == null || name.isEmpty() ? "you" : name;
return "One for " + nameToDisplay + ", one for me.";
}
}
9 changes: 9 additions & 0 deletions exercises/two-fer/src/test/java/TwoferTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ public void noNameGiven() {
assertEquals(expected, twofer.twofer(input));
}

@Ignore("Remove to run test")
@Test
public void emptyNameGiven() {
String input = "";
String expected = "One for you, one for me.";

assertEquals(expected, twofer.twofer(input));
}

@Ignore("Remove to run test")
@Test
public void aNameGiven() {
Expand Down

0 comments on commit c3731cb

Please sign in to comment.