### Question:
Extractors { public Extractor<?> valueOf( String name ) { Extractor<?> instance = instances.get( name.toUpperCase() ); if ( instance == null ) { throw new IllegalArgumentException( "'" + name + "'" ); } return instance; } Extractors( char arrayDelimiter );  Extractors( char arrayDelimiter, boolean emptyStringsAsNull );  Extractors( char arrayDelimiter, boolean emptyStringsAsNull, boolean trimStrings );  Extractors( char arrayDelimiter, boolean emptyStringsAsNull, boolean trimStrings, Supplier<ZoneId> defaultTimeZone ); void add( Extractor<?> extractor ); Extractor<?> valueOf( String name ); Extractor<String> string(); LongExtractor long_(); IntExtractor int_(); CharExtractor char_(); ShortExtractor short_(); ByteExtractor byte_(); BooleanExtractor boolean_(); FloatExtractor float_(); DoubleExtractor double_(); Extractor<String[]> stringArray(); Extractor<boolean[]> booleanArray(); Extractor<byte[]> byteArray(); Extractor<short[]> shortArray(); Extractor<int[]> intArray(); Extractor<long[]> longArray(); Extractor<float[]> floatArray(); Extractor<double[]> doubleArray(); PointExtractor point(); DateExtractor date(); TimeExtractor time(); DateTimeExtractor dateTime(); LocalTimeExtractor localTime(); LocalDateTimeExtractor localDateTime(); DurationExtractor duration();  }### Answer:
@Test void shouldExtractStringArray() { Extractors extractors = new Extractors( ',' ); String data = "abcde,fghijkl,mnopq"; @SuppressWarnings( "unchecked" ) Extractor<String[]> extractor = (Extractor<String[]>) extractors.valueOf( "STRING[]" ); extractor.extract( data.toCharArray(), 0, data.length(), false ); assertArrayEquals( new String[] {"abcde","fghijkl","mnopq"}, extractor.value() ); }
@Test void shouldExtractLongArray() { Extractors extractors = new Extractors( ',' ); long[] longData = new long[] {123,4567,987654321}; String data = toString( longData, ',' ); @SuppressWarnings( "unchecked" ) Extractor<long[]> extractor = (Extractor<long[]>) extractors.valueOf( "long[]" ); extractor.extract( data.toCharArray(), 0, data.length(), false ); assertArrayEquals( longData, extractor.value() ); }
@Test void shouldFailExtractingLongArrayWhereAnyValueIsntReallyANumber() { Extractors extractors = new Extractors( ';' ); String data = "123;456;abc;789"; assertThrows( NumberFormatException.class, () -> extractors.valueOf( "long[]" ).extract( data.toCharArray(), 0, data.length(), false ) ); }