### Question:
Config { public void load( Reader reader ) throws IOException { if( reader != null ) { BufferedReader input = new BufferedReader( reader ); String profile = null; String line = input.readLine(); while( line != null ) { line = line.trim(); if(line.isEmpty()) { } else if( line.startsWith( COMMENT_PREFIX ) ) { } else if( line.startsWith( SECTION_PREFIX ) ) { Matcher matcher = SECTION_PATTERN.matcher( line ); if( matcher.matches() ) { profile = matcher.group( 1 ); } } else { Matcher matcher = PAIR_PATTERN.matcher( line ); if( matcher.matches() ) { if( matcher.groupCount() > 0 ) { String name = matcher.group( 1 ); String value = null; if( matcher.groupCount() > 1 ) { value = matcher.group( 2 ); } set( profile, name, value ); } } } line = input.readLine(); } } } Config(); void load( Reader reader ); void save( Writer writer ); String get( String section, String name ); void set( String section, String name, String value );  }### Answer:
@Test public void testLoad() throws Exception { Config c; String s; c = new Config(); c.load( null ); c = new Config(); s = ""; c.load( new StringReader( s ) ); assertThat( c.get( null, null ), nullValue() ); c = new Config(); s = "name=value"; c.load( new StringReader( s ) ); assertThat( c.get( null, "name" ), is( "value" ) ); assertThat( c.get( null, "wrong-name" ), nullValue() ); s = "name1=value1" + NEWLINE + "[section1]" + NEWLINE + "name1=value2"; c = new Config(); c.load( new StringReader( s ) ); assertThat( c.get( "", "name1" ), is( "value1" ) ); assertThat( c.get( "", "name2" ), nullValue() ); assertThat( c.get( "section1", "name1" ), is( "value2" ) ); assertThat( c.get( "section1", "name2" ), nullValue() ); }