### Question:
OptionsBuilder { public String build(final String... options) { LOG.debug("options: {}", Arrays.toString(options)); final StringBuffer sb = new StringBuffer("{"); if (options != null) { for (int i = 0; i < options.length; i++) { final String option = options[i]; if (!StringUtils.isEmpty(option)) { sb.append(processSingleOption(option)); if (i < options.length - 1) { sb.append(","); } } } } sb.append("}"); LOG.debug("options: {}", sb); return sb.toString(); }  String[] splitOptions(final String optionAsString); String buildFromCsv(final String optionsAsCsv); String build(final String... options);  }### Answer:
@Test public void shouldBuildOptions() throws Exception { assertEquals("{}", optionsBuilder.build("")); }
@Test public void shouldBuildOptionsFromNullArray() throws Exception { final String[] options = null; assertEquals("{}", optionsBuilder.build(options)); }
@Test public void testOptionWithNoValue() throws Exception { assertEquals("{\"devel\": true}", optionsBuilder.build("devel")); }
@Test public void testOptionWithValue() throws Exception { assertEquals("{\"maxerr\": 100}", optionsBuilder.build("maxerr=100")); }
@Test public void predefOption() throws Exception { assertEquals("{\"predef\": ['YUI']}", optionsBuilder.build("predef=['YUI']")); }
@Test public void predefOptionWithQuotes() throws Exception { assertEquals("{\"predef\": \"['YUI']\"}", optionsBuilder.build("predef=\"['YUI']\"")); }
@Test public void predefOptionWithManyOptions() throws Exception { assertEquals("{\"predef\": ['YUI','window','document','OnlineOpinion','xui']}", optionsBuilder.build("predef=['YUI','window','document','OnlineOpinion','xui']")); }
@Test public void testOptionWithValueAndSpaces() throws Exception { assertEquals("{\"maxerr\": 100}", optionsBuilder.build("maxerr = 100")); }
@Test(expected = IllegalArgumentException.class) public void testOptionWithEmptyValue() throws Exception { assertEquals("{\"maxerr\": 100}", optionsBuilder.build("maxerr=")); }