added append function

This commit is contained in:
Shekhar Gulati
2016-05-03 19:09:25 +05:30
parent c8242324bf
commit 04aa5e0b36
2 changed files with 35 additions and 1 deletions
+13 -1
View File
@@ -2,9 +2,21 @@ package strman;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import static strman.Strman.append;
public class StrmanTest {
@Test
public void shouldAppendStringsToEndOfValue() throws Exception {
assertThat(append("f", "o", "o", "b", "a", "r"), equalTo("foobar"));
assertThat(append("foobar"), equalTo("foobar"));
assertThat(append("", "foobar"), equalTo("foobar"));
}
@Test(expected = IllegalArgumentException.class)
public void appendShouldThrowIllegalArgumentExceptionWhenValueIsNull() throws Exception {
append(null);
}
}