### Question:
ThresholdConfigParser { public static ThresholdConfigValue parse( String configValue ) { String[] tokens = configValue.split( " " ); if ( tokens.length == 0 ) { throw new IllegalArgumentException( "Invalid log pruning configuration value '" + configValue + "'" ); } final String boolOrNumber = tokens[0]; if ( tokens.length == 1 ) { switch ( boolOrNumber ) { case "keep_all": case "true": return ThresholdConfigValue.NO_PRUNING; case "keep_none": case "false": return ThresholdConfigValue.KEEP_LAST_FILE; default: throw new IllegalArgumentException( "Invalid log pruning configuration value '" + configValue + "'. The form is 'true', 'false' or '<number><unit> <type>'. For example, '100k txs' " + "will keep the 100 000 latest transactions." ); } } else { long thresholdValue = parseLongWithUnit( boolOrNumber ); String thresholdType = tokens[1]; return new ThresholdConfigValue( thresholdType, thresholdValue ); } } private  ThresholdConfigParser(); static ThresholdConfigValue parse( String configValue );  }### Answer:
@Test public void parseTrue() { ThresholdConfigValue configValue = parse( "true" ); assertEquals( NO_PRUNING, configValue ); }
@Test public void parseFalse() { ThresholdConfigValue configValue = parse( "false" ); assertEquals( KEEP_LAST_FILE, configValue ); }
@Test( expected = IllegalArgumentException.class ) public void parseGarbage() { parse( "davide" ); fail( "Expected IllegalArgumentException" ); }