@Test public void countWords() throws Exception { assertEquals(0, countOf("")); assertEquals(0, countOf(" ")); assertEquals(1, countOf("asd ")); assertEquals(1, countOf(" asd")); assertEquals(1, countOf(" asd ")); assertEquals(1, countOf("asd\tasd")); assertEquals(2, countOf("sdf asd")); assertEquals(2, countOf("sdf asd")); assertEquals(2, countOf("sdf asd")); }
@Override public int countWords(final ParsedPage parsedPage) { Validate.notNull(parsedPage, "parsedPage must not be null"); String text = parsedPage.getText(); int wordCount = new StringTokenizer(text, " ").countTokens(); print("countWords: %s", wordCount); return wordCount; }
CounterBackendImpl implements CounterBackend { @Override public int countWords(final ParsedPage parsedPage) { Validate.notNull(parsedPage, "parsedPage must not be null"); String text = parsedPage.getText(); int wordCount = new StringTokenizer(text, " ").countTokens(); print("countWords: %s", wordCount); return wordCount; } }
CounterBackendImpl implements CounterBackend { @Override public int countWords(final ParsedPage parsedPage) { Validate.notNull(parsedPage, "parsedPage must not be null"); String text = parsedPage.getText(); int wordCount = new StringTokenizer(text, " ").countTokens(); print("countWords: %s", wordCount); return wordCount; }  }
CounterBackendImpl implements CounterBackend { @Override public int countWords(final ParsedPage parsedPage) { Validate.notNull(parsedPage, "parsedPage must not be null"); String text = parsedPage.getText(); int wordCount = new StringTokenizer(text, " ").countTokens(); print("countWords: %s", wordCount); return wordCount; }  @Override int countWords(final ParsedPage parsedPage); }
CounterBackendImpl implements CounterBackend { @Override public int countWords(final ParsedPage parsedPage) { Validate.notNull(parsedPage, "parsedPage must not be null"); String text = parsedPage.getText(); int wordCount = new StringTokenizer(text, " ").countTokens(); print("countWords: %s", wordCount); return wordCount; }  @Override int countWords(final ParsedPage parsedPage);  }