public static Map<String, Integer> retrieveTags(Note note) {
    HashMap<String, Integer> tagsMap = new HashMap<>();
    String[] words = (note.getTitle() + " " + note.getContent()).replaceAll("\n", " ").trim()
        .split(" ");
    for (String word : words) {
      String parsedHashtag = UrlCompleter.parseHashtag(word);
      if (StringUtils.isNotEmpty(parsedHashtag)) {
        int count = tagsMap.get(parsedHashtag) == null ? 0 : tagsMap.get(parsedHashtag);
        tagsMap.put(parsedHashtag, ++count);
      }
    }
    return tagsMap;
  }
@Test
  public void retrievesTagsFromNote() {
    Map<String, Integer> tags = TagsHelper.retrieveTags(note);
    assertEquals(4, tags.size());
    assertTrue(tags.containsKey(TAG1.getText()) && tags.containsKey(TAG2.getText())
        && tags.containsKey(TAG3.getText()) && tags.containsKey(TAG4.getText()));
    assertFalse(tags.containsKey(TAG_INVALID.getText()));
  }