DirectoryTree { public void setRootDirectoryAndNotify(File rootDirectory){ this.root = rootDirectory; bus.post(new CurrentRootDirectoryChangedEvent(rootDirectory)); } DirectoryTree(EventBus bus); void setRootDirectoryAndNotify(File rootDirectory); void setParentDirectory(File parentDirectory); File getRoot(); File getParentDirectory(); public DirectoryList directoryList; }
@Test public void changingRootDirectoryShouldNotifyThroughBus() throws Exception { File mockRootDirectory = mock(File.class); CurrentRootDirectoryChangedEvent expectedEvent = new CurrentRootDirectoryChangedEvent(mockRootDirectory); sut.setRootDirectoryAndNotify(mockRootDirectory); verify(mockBus).post(eq(expectedEvent)); }