@Test
public void givenNull_returnsEmptyString() {
assertEquals("", invertedName(null));
}
@Test
public void givenEmptyString_returnsEmptyString() {
assertEquals("", invertedName(""));
}
@Test
public void givenNull_returnsEmptyString() {
assertInverted(null, "");
}
@Test
public void givenEmptyString_returnsEmptyString() {
assertInverted("", "");
}
public void assertInverted(String originalName, String invertedName){
assertEquals(invertedName, invertedName(originalName));
}
--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.
The ambiguity of argument order in assertEquals is one reason to prefer Hamcrest marchers (which are included in JUnit). The Hamcrest syntax isassertThat(actual, predicate)where the predicate is a "matcher" such as equalTo(expected).