### Question:
ConversationManager { public Task<HttpsCallableResult> addFriend(String targetUid) { FirebaseFunctions mFunctions = FirebaseFunctions.getInstance(); Map<String, Object> data = new HashMap<>(); data.put("targetUid", targetUid); return mFunctions.getHttpsCallable("addFriend").call(data); } 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 testAddFriend() { Map<String, Object> data = new HashMap<>(); String uid = "user"; data.put("targetUid", uid); assertNotNull(data); mHttpsCallableReference = mock(HttpsCallableReference.class); when(mFirebaseFunction.getHttpsCallable("addFriend")).thenReturn(mHttpsCallableReference); when(mHttpsCallableReference.call(data)).thenReturn(null); conversationManager.addFriend(uid); verify(mFirebaseFunction, times(1)).getHttpsCallable("addFriend"); verify(mHttpsCallableReference, atLeastOnce()).call(data); }