### Question:
URISupport { public static CompositeData parseComposite(URI uri) throws URISyntaxException { CompositeData rc = new CompositeData(); rc.scheme = uri.getScheme(); String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), " parseComposite(uri, rc, ssp); rc.fragment = uri.getFragment(); return rc; }  static Map<String, String> parseQuery(String uri); static Map<String, String> parseParameters(URI uri); static URI applyParameters(URI uri, Map<String, String> queryParameters); static URI applyParameters(URI uri, Map<String, String> queryParameters, String optionPrefix); static URI removeQuery(URI uri); static URI createURIWithQuery(URI uri, String query); static CompositeData parseComposite(URI uri); static boolean isCompositeURI(URI uri); static int indexOfParenthesisMatch(String str, int first); static String stripPrefix(String value, String prefix); static URI stripScheme(URI uri); static String createQueryString(Map<String, ? extends Object> options); static URI createRemainingURI(URI originalURI, Map<String, String> params); static URI changeScheme(URI bindAddr, String scheme); static boolean checkParenthesis(String str);  }### Answer:
@Test public void testEmptyCompositePath() throws Exception { CompositeData data = URISupport.parseComposite(new URI("broker:()/localhost?persistent=false")); assertEquals(0, data.getComponents().length); }
@Test public void testCompositePath() throws Exception { CompositeData data = URISupport.parseComposite(new URI("test:(path)/path")); assertEquals("path", data.getPath()); data = URISupport.parseComposite(new URI("test:path")); assertNull(data.getPath()); }
@Test public void testSimpleComposite() throws Exception { CompositeData data = URISupport.parseComposite(new URI("test:part1")); assertEquals(1, data.getComponents().length); }
@Test public void testComposite() throws Exception { URI uri = new URI("test:(part1: CompositeData data = URISupport.parseComposite(uri); assertEquals(2, data.getComponents().length); }
@Test public void testEmptyCompositeWithParenthesisInParam() throws Exception { URI uri = new URI("failover: CompositeData data = URISupport.parseComposite(uri); assertEquals(0, data.getComponents().length); assertEquals(1, data.getParameters().size()); assertTrue(data.getParameters().containsKey("updateURIsURL")); assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL")); }
@Test public void testCompositeWithParenthesisInParam() throws Exception { URI uri = new URI("failover: CompositeData data = URISupport.parseComposite(uri); assertEquals(1, data.getComponents().length); assertEquals(1, data.getParameters().size()); assertTrue(data.getParameters().containsKey("updateURIsURL")); assertEquals("file:/C:/Dir(1)/a.csv", data.getParameters().get("updateURIsURL")); }
@Test public void testParsingCompositeURI() throws URISyntaxException { CompositeData data = URISupport.parseComposite(new URI("broker: assertEquals("one component", 1, data.getComponents().length); assertEquals("Size: " + data.getParameters(), 1, data.getParameters().size()); }