Skip to content
Snippets Groups Projects

Resolve "Switch to autonomous kata organisation"

Merged Colin DAMON requested to merge 5-switch-to-autonomous-kata into master
@@ -10,36 +10,40 @@ import static org.assertj.core.api.Assertions.*;
class WrapperTest {
@Test
void shouldNotWrapWithoutSentence(){
assertThat(wrap(null,4)).isNull();
}
@Test
void shouldNotWrapShortEnoughSentence(){
assertThat(wrap("Once",4)).isEqualTo("Once");
}
@Test
void shouldWrapBySplittingWord(){
assertThat(wrap("Once",2)).isEqualTo("On\nce");
}
@Test
void shouldWrapBySplittingWordMultipleItems(){
assertThat(wrap("Once",1))
.isEqualTo(join("O","n","c","e"));
}
@Test
void shouldWrapAfterWord(){
assertThat(wrap("Once uppon a time",10))
.isEqualTo(join("Once uppon","a time"));
}
private static String join (String... parts){
return Arrays.stream(parts)
.collect(Collectors.joining("\n"));
}
@Test
void shouldNotWrapWithoutSentence() {
assertThat(wrap(null, 4)).isNull();
}
@Test
void shouldNotWrapShortEnoughSentence() {
assertThat(wrap("Once", 4)).isEqualTo("Once");
}
@Test
void shouldWrapBySplittingWord() {
assertThat(wrap("Once", 2)).isEqualTo("On\nce");
}
@Test
void shouldWrapBySplittingWordMultipleItems() {
assertThat(wrap("Once", 1)).isEqualTo(join("O", "n", "c", "e"));
}
@Test
void shouldWrapAfterWord() {
assertThat(wrap("Once upon a time", 9))
.isEqualTo(join("Once upon", "a time"));
}
@Test
void shouldWrapBetweenWords() {
assertThat(wrap("Once upon a time in Hollywood", 13))
.isEqualTo(join("Once upon a", "time in", "Hollywood"));
}
private static String join(String... parts) {
return Arrays.stream(parts).collect(Collectors.joining("\n"));
}
}
\ No newline at end of file
Loading