@Test public void asEnvironments_smokes() throws Exception { assertThat(PromotionConfiguration.asEnvironments(null), nullValue()); assertThat(PromotionConfiguration.asEnvironments(""), nullValue()); assertThat(PromotionConfiguration.asEnvironments(",,,,"), nullValue()); assertThat(PromotionConfiguration.asEnvironments("``, '', \"\""), nullValue()); assertThat(PromotionConfiguration.asEnvironments("foo"), is(Collections.singleton("foo"))); assertThat(PromotionConfiguration.asEnvironments("foo bar"), is(asSet("foo", "bar"))); assertThat(PromotionConfiguration.asEnvironments("`foo` `bar`"), is(asSet("foo", "bar"))); assertThat(PromotionConfiguration.asEnvironments("`foo bar`"), is(asSet("foo bar"))); assertThat( PromotionConfiguration.asEnvironments("`foo \"bar\" manchu\\``, ha"), is(asSet("foo \"bar\" manchu`", "ha"))); }
@Test public void asEnvironmentsString_smokes() throws Exception { assertThat(PromotionConfiguration.asEnvironmentsString(null), nullValue()); assertThat( PromotionConfiguration.asEnvironmentsString(Collections.<String>emptySet()), nullValue()); assertThat(PromotionConfiguration.asEnvironmentsString(asSet("")), nullValue()); assertThat(PromotionConfiguration.asEnvironmentsString(asSet("", "", "", "")), nullValue()); assertThat( PromotionConfiguration.asEnvironmentsString(Collections.singleton("foo")), is("foo")); assertThat(PromotionConfiguration.asEnvironmentsString(asSet("foo", "bar")), is("foo bar")); assertThat(PromotionConfiguration.asEnvironmentsString(asSet("foo bar")), is("\"foo bar\"")); assertThat( PromotionConfiguration.asEnvironmentsString(asSet("foo \"bar\" manchu`", "ha")), is("\"foo \\\"bar\\\" manchu\\`\" ha")); }