### Question:
OptionsBuilder { public String[] splitOptions(final String optionAsString) { return optionAsString == null ? ArrayUtils.EMPTY_STRING_ARRAY : optionAsString.split("(?ims),(?![^\\[\\]]*\\])"); }  String[] splitOptions(final String optionAsString); String buildFromCsv(final String optionsAsCsv); String build(final String... options);  }### Answer:
@Test public void splitingNullOptionProduceEmptyArray() { assertTrue(Arrays.equals(ArrayUtils.EMPTY_STRING_ARRAY, optionsBuilder.splitOptions(null))); }
@Test public void splitingEmptyOption() { assertTrue(Arrays.equals(new String[] { "" }, optionsBuilder.splitOptions(""))); }
@Test public void splitingOneOption() { assertTrue(Arrays.equals(new String[] { "o1" }, optionsBuilder.splitOptions("o1"))); }
@Test public void splitingTwoOptions() { assertTrue(Arrays.equals(new String[] { "o1", "o2" }, optionsBuilder.splitOptions("o1,o2"))); }
@Test public void splitingComplexOption() { final String option = "predef=['YUI','window','document','OnlineOpinion','xui']"; final String[] result = optionsBuilder.splitOptions(option); assertEquals(1, result.length); assertTrue(Arrays.equals(new String[] { option }, result)); }
@Test public void splitingComplexOptions() { final String option = "option1,option2,option3=['YUI','window','document','xui'],option4,option5=['YUI','xui'],option6"; final String[] result = optionsBuilder.splitOptions(option); assertEquals(6, result.length); assertEquals( Arrays.toString(new String[] { "option1", "option2", "option3=['YUI','window','document','xui']", "option4", "option5=['YUI','xui']", "option6" }), Arrays.toString(result)); }
@Test public void splitOptionsWithHiphen() { final String option = "ids,adjoining-classes,box-model,box-sizing,compatible-vendor-prefixes,display-property-grouping,duplicate-background-images,duplicate-properties,empty-rules,errors,fallback-colors,floats,font-faces,font-sizes,gradients,import,important,known-properties,outline-none,overqualified-elements,qualified-headings,regex-selectors,rules-count,shorthand,text-indent,unique-headings,universal-selector,unqualified-attributes"; final String[] result = optionsBuilder.splitOptions(option); assertEquals(28, result.length); }