@Test public void countChars () { Note note = getNote(1L, "one two", "three four five\nAnother line"); assertEquals(30, new DefaultWordCounter().countChars(note)); }
@Override public int countChars (Note note) { String titleAndContent = note.getTitle() + "\n" + note.getContent(); return Observable .from(sanitizeTextForWordsAndCharsCount(note, titleAndContent).split("")) .filter(s -> !s.matches("\\s")) .count().toBlocking().single(); }
DefaultWordCounter implements WordCounter { @Override public int countChars (Note note) { String titleAndContent = note.getTitle() + "\n" + note.getContent(); return Observable .from(sanitizeTextForWordsAndCharsCount(note, titleAndContent).split("")) .filter(s -> !s.matches("\\s")) .count().toBlocking().single(); } }
DefaultWordCounter implements WordCounter { @Override public int countChars (Note note) { String titleAndContent = note.getTitle() + "\n" + note.getContent(); return Observable .from(sanitizeTextForWordsAndCharsCount(note, titleAndContent).split("")) .filter(s -> !s.matches("\\s")) .count().toBlocking().single(); }  }
DefaultWordCounter implements WordCounter { @Override public int countChars (Note note) { String titleAndContent = note.getTitle() + "\n" + note.getContent(); return Observable .from(sanitizeTextForWordsAndCharsCount(note, titleAndContent).split("")) .filter(s -> !s.matches("\\s")) .count().toBlocking().single(); }  @Override int countWords(Note note); @Override int countChars(Note note); }
DefaultWordCounter implements WordCounter { @Override public int countChars (Note note) { String titleAndContent = note.getTitle() + "\n" + note.getContent(); return Observable .from(sanitizeTextForWordsAndCharsCount(note, titleAndContent).split("")) .filter(s -> !s.matches("\\s")) .count().toBlocking().single(); }  @Override int countWords(Note note); @Override int countChars(Note note);  }