### Question:
WordScanner { public String nextWord() throws IOException { String res = null; while (res == null) { if (matcher.find()) { res = matcher.group(0); } else if (reader.ready()) { matcher = pattern.matcher(reader.readLine()); } else { break; } } return res; } WordScanner(InputStream is, Charset encoding, String regex);  WordScanner(InputStream is, Charset encoding);  WordScanner(File file, Charset encoding, String regex);  WordScanner(File file, Charset encoding);  WordScanner(File file, String regex);  WordScanner(String s, String regex);  WordScanner(String s); static StringBuilder scanToStringBuilder(File file, String regex); String nextWord(); static void main(String[] args);  }### Answer:
@Test public void testnextWord() throws IOException { System.out.println("main"); String input = "hola&amigo2\n3.14 mi casa, todos los días\n" + "mesa-camilla java4you i.b.m. i+d Dª María 3+100%"; WordScanner scanner = new WordScanner(input, null); String word; int num = 0; while ((word = scanner.nextWord()) != null) { ++num; } assertEquals(18, num); }