Reasons { public static String coalesce(final String... reasons) { final StringBuilder buf = new StringBuilder(); for (final String reason : reasons) { appendIfNotNull(buf, reason); } return asStringElseNull(buf); } private  Reasons(); static String coalesce(final String... reasons);  }
@Test public void testNoReasonReturnsNull() throws Exception { assertThat(Reasons.coalesce(), is(nullValue())); }
@Test public void testSingleNullReturnsNull() throws Exception { assertThat(Reasons.coalesce((String) null), is(nullValue())); }
@Test public void testSingleNonNullReturnsSame() throws Exception { assertThat(Reasons.coalesce("yada"), is("yada")); }
@Test public void testNullThenNonNullReturnsLatter() throws Exception { assertThat(Reasons.coalesce(null, "yada"), is("yada")); }
@Test public void testNotNullThenNonNullReturnsBothConcatenated() throws Exception { assertThat(Reasons.coalesce("foobar", "yada"), is("foobar; yada")); }
@Test public void testNotNullThenNullBothFormer() throws Exception { assertThat(Reasons.coalesce("foobar", null), is("foobar")); }
@Test public void testNullsAreSkippedThenNonNull() throws Exception { assertThat(Reasons.coalesce("foobar", null, "yada"), is("foobar; yada")); }