import org.junit.Test; import com.google.common.base.Joiner; public class Collections { @Test public void Joiner_on_list_with_one_null_value() { String actual = Joiner .on(",") .skipNulls() .join("one",null,"two"); assertEquals("one,two", actual); } @Test public void Joiner_on_map() { Mapmap = new HashMap (); map.put("k1", "v1"); map.put("k2", "v2"); String actual = Joiner .on(",") .withKeyValueSeparator(" => ") .join(map); assertEquals("k1 => v1,k2 => v2", actual); } }