### Question:
ConversationManager { public Task<Void> deleteFriend(String targetUid) { String convId = getPrivateConvId(targetUid); return db.collection("conversations").document(convId).update("isDeleted", true); } ConversationManager(); static ConversationManager getInstance(); static void init(); void stopListening(); Conversation getConversation(String convId); String getPrivateConvId(String userId); PrivateConversation getPrivateConversation(String userId); ArrayList<Conversation> getConversations(); ArrayList<String> getFriendList(); Task<HttpsCallableResult> addFriend(String targetUid); Task<Void> deleteFriend(String targetUid); Task<HttpsCallableResult> createGroupChat(ArrayList<String> users, String name, String icon); void waitForOpenChatAvtivity(String convId); void deleteGroup(String convId); String getUid(); final static String BROADCAST_CONVERSATION_UPDATED; final static String BROADCAST_MESSAGE_READ_CHANGE; }### Answer:
@Test public void testDeleteFriend() { String cid = "conversation"; mCollection = mock(CollectionReference.class); mDocument = mock(DocumentReference.class); when(mFirebaseFirestore.collection("conversations")).thenReturn(mCollection); when(mCollection.document(cid)).thenReturn(mDocument); when(mDocument.update("isDeleted", true)).thenReturn(null); mFirebaseFirestore.collection("conversations").document(cid).update("isDeleted", true); verify(mFirebaseFirestore, times(1)).collection("conversations"); verify(mCollection, times(1)).document(cid); verify(mDocument, times(1)).update("isDeleted", true); }