@Test public void putNoteTest() { assertEquals(6, folderView.countNotes()); assertEquals(3, folderView.countFolders()); assertEquals(2, rootFolder.countNotes()); assertEquals(2, aFolder.countNotes()); assertEquals(2, abFolder.countNotes()); assertEquals("note1", rootNote1.getName()); assertEquals("/note2", rootNote2.getName()); assertEquals("a/note1", aNote1.getName()); assertEquals("/a/note2", aNote2.getName()); assertEquals("a/b/note1", abNote1.getName()); assertEquals("/a/b/note2", abNote2.getName()); }
public void putNote(Note note) { if (note.isNameEmpty()) { return; } String folderId = note.getFolderId(); Folder folder = getOrCreateFolder(folderId); folder.addNote(note); synchronized (index) { index.put(note, folder); } }
FolderView implements NoteNameListener, FolderListener { public void putNote(Note note) { if (note.isNameEmpty()) { return; } String folderId = note.getFolderId(); Folder folder = getOrCreateFolder(folderId); folder.addNote(note); synchronized (index) { index.put(note, folder); } } }
FolderView implements NoteNameListener, FolderListener { public void putNote(Note note) { if (note.isNameEmpty()) { return; } String folderId = note.getFolderId(); Folder folder = getOrCreateFolder(folderId); folder.addNote(note); synchronized (index) { index.put(note, folder); } }  }
FolderView implements NoteNameListener, FolderListener { public void putNote(Note note) { if (note.isNameEmpty()) { return; } String folderId = note.getFolderId(); Folder folder = getOrCreateFolder(folderId); folder.addNote(note); synchronized (index) { index.put(note, folder); } }  Folder getFolder(String folderId); Folder renameFolder(String oldFolderId, String newFolderId); Folder getFolderOf(Note note); void putNote(Note note); void removeNote(Note note); void clear(); boolean hasFolder(String folderId); boolean hasNote(Note note); int countFolders(); int countNotes(); @Override void onNoteNameChanged(Note note, String oldName); @Override void onFolderRenamed(Folder folder, String oldFolderId); }
FolderView implements NoteNameListener, FolderListener { public void putNote(Note note) { if (note.isNameEmpty()) { return; } String folderId = note.getFolderId(); Folder folder = getOrCreateFolder(folderId); folder.addNote(note); synchronized (index) { index.put(note, folder); } }  Folder getFolder(String folderId); Folder renameFolder(String oldFolderId, String newFolderId); Folder getFolderOf(Note note); void putNote(Note note); void removeNote(Note note); void clear(); boolean hasFolder(String folderId); boolean hasNote(Note note); int countFolders(); int countNotes(); @Override void onNoteNameChanged(Note note, String oldName); @Override void onFolderRenamed(Folder folder, String oldFolderId);  }