### Question:
BndUtils { public static Properties parseInstructions( final String query ) throws MalformedURLException { final Properties instructions = new Properties(); if( query != null ) { try { final String segments[] = query.split( "&" ); for( String segment : segments ) { if( segment.trim().length() > 0 ) { final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment ); if( matcher.matches() ) { String key = matcher.group( 1 ); String val = matcher.group( 2 ); instructions.setProperty( verifyKey(key), val != null ? URLDecoder.decode( val, "UTF-8" ) : "" ); } else { throw new MalformedURLException( "Invalid syntax for instruction [" + segment + "]. Take a look at http: ); } } } } catch( UnsupportedEncodingException e ) { throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e ); } } return instructions; } private  BndUtils(); static InputStream createBundle( final InputStream jarInputStream,
                                            final Properties instructions,
                                            final String jarInfo ); static InputStream createBundle( final InputStream jarInputStream,
                                            final Properties instructions,
                                            final String jarInfo,
                                            final OverwriteMode overwriteMode ); static Properties parseInstructions( final String query );  }### Answer:
@Test public void emptyInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "" ); assertEquals( 0, p.size() ); }
@Test public void oneInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "foo=bar" ); assertEquals( "bar", p.getProperty( "foo" ) ); }
@Test public void multipleSimpleInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "foo=bar&sing=sang&cheese=bacon" ); assertEquals( "bar", p.getProperty( "foo" ) ); assertEquals( "sang", p.getProperty( "sing" ) ); assertEquals( "bacon", p.getProperty( "cheese" ) ); }
@Test public void complexOneInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "Export-Package=*;version=\"2.4.0\"" ); assertEquals( "*;version=\"2.4.0\"", p.getProperty( "Export-Package" ) ); }
@Test public void complexManyInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "Export-Package=*;version=\"2.4.0\"&sec=two" ); assertEquals( "*;version=\"2.4.0\"", p.getProperty( "Export-Package" ) ); assertEquals( "two", p.getProperty( "sec" ) ); }
@Test public void versionRangeImportInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "Import-Package=javax.servlet.*;version=\"[2.3.0,3)\"" ); assertEquals( "javax.servlet.*;version=\"[2.3.0,3)\"", p.getProperty("Import-Package")); }
@Test public void whiteSpaceInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "Export-Package=*; version=\"2.4.0\""); assertEquals( "*; version=\"2.4.0\"", p.getProperty( "Export-Package" ) ); }
@Test public void backslashesInstructionTest() throws MalformedURLException { Properties p = BndUtils.parseInstructions( "Bundle-SymbolicName=C:\\Users\\Administrator\\Downloads\\jboss-fuse"); assertEquals( "C:\\Users\\Administrator\\Downloads\\jboss-fuse", p.getProperty( "Bundle-SymbolicName" ) ); }