DirectoryController { public void onEvent(UpdateDirectoryTreeEvent event) { listDirectoryOperation.compute(event.rootDirectory); } DirectoryController(Context context, EventBus bus, RecyclerView recyclerView); void onEvent(UpdateDirectoryTreeEvent event); void onEvent(MakeDirectoryEvent event); void onEvent(DataSetChangedEvent event);  }
@Test public void shouldCollaborateWithMakeDirectoryOperation() throws Exception { File mockRootDirectory = mock(File.class); MakeDirectoryEvent event = new MakeDirectoryEvent(mockRootDirectory, "newDirectory"); sut.onEvent(event); verify(sut.makeDirectoryOperation).compute(mockRootDirectory, "newDirectory"); }
@Test public void onDataSetChangedEventShouldNotifyAdapter() throws Exception { sut.adapter = mock(DirectoryAdapter.class); sut.onEvent(new DataSetChangedEvent()); verify(sut.adapter).notifyDataSetChanged(); }
@Test public void shouldCollaborateWithListDirectoryOperation() throws Exception { File mockRootDirectory = mock(File.class); UpdateDirectoryTreeEvent event = new UpdateDirectoryTreeEvent(mockRootDirectory); sut.onEvent(event); verify(sut.listDirectoryOperation).compute(mockRootDirectory); }