@Test public void testSendMessageToMultipleUsersUsingOtt() { final LineApiResponse<?> mockResponse = LineApiResponse.createAsSuccess(""); givenPostWithJsonApiResponse(mockResponse); LineApiResponse<List<SendMessageResponse>> actualResult = target.sendMessageToMultipleUsers( ACCESS_TOKEN, Collections.emptyList(), Collections.emptyList(), true); assertThat(actualResult, sameInstance(mockResponse)); verifyApiCallPostWithJson("/" + BASE_PATH_MESSAGE_API + "/" + PATH_OTT_ISSUE); responseParserInstanceShouldBe(TalkApiClient.StringParser.class); verifyApiCallPostWithJson("/" + BASE_PATH_MESSAGE_API + "/" + PATH_OTT_SHARE); responseParserInstanceShouldBe(TalkApiClient.MultiSendResponseParser.class); }
@VisibleForTesting @NonNull protected LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsersUsingOtt( @NonNull InternalAccessToken accessToken, @NonNull String ott, @NonNull List<MessageData> messages) { String postData; try { postData = MessageSendRequest.createOttType(ott, messages).toJsonString(); } catch (JSONException e) { return createInternalErrorResponse(e); } return httpClient.postWithJson( buildUri(apiBaseUrl, BASE_PATH_MESSAGE_API, PATH_OTT_SHARE), buildRequestHeaders(accessToken), postData, MULTI_SEND_RESPONSE_PARSER); }
TalkApiClient { @VisibleForTesting @NonNull protected LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsersUsingOtt( @NonNull InternalAccessToken accessToken, @NonNull String ott, @NonNull List<MessageData> messages) { String postData; try { postData = MessageSendRequest.createOttType(ott, messages).toJsonString(); } catch (JSONException e) { return createInternalErrorResponse(e); } return httpClient.postWithJson( buildUri(apiBaseUrl, BASE_PATH_MESSAGE_API, PATH_OTT_SHARE), buildRequestHeaders(accessToken), postData, MULTI_SEND_RESPONSE_PARSER); } }
TalkApiClient { @VisibleForTesting @NonNull protected LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsersUsingOtt( @NonNull InternalAccessToken accessToken, @NonNull String ott, @NonNull List<MessageData> messages) { String postData; try { postData = MessageSendRequest.createOttType(ott, messages).toJsonString(); } catch (JSONException e) { return createInternalErrorResponse(e); } return httpClient.postWithJson( buildUri(apiBaseUrl, BASE_PATH_MESSAGE_API, PATH_OTT_SHARE), buildRequestHeaders(accessToken), postData, MULTI_SEND_RESPONSE_PARSER); } TalkApiClient(Context applicationContext, @NonNull Uri apiBaseUrl); @VisibleForTesting  TalkApiClient(
            @NonNull Uri apiBaseUrl,
            @NonNull ChannelServiceHttpClient httpClient); }
TalkApiClient { @VisibleForTesting @NonNull protected LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsersUsingOtt( @NonNull InternalAccessToken accessToken, @NonNull String ott, @NonNull List<MessageData> messages) { String postData; try { postData = MessageSendRequest.createOttType(ott, messages).toJsonString(); } catch (JSONException e) { return createInternalErrorResponse(e); } return httpClient.postWithJson( buildUri(apiBaseUrl, BASE_PATH_MESSAGE_API, PATH_OTT_SHARE), buildRequestHeaders(accessToken), postData, MULTI_SEND_RESPONSE_PARSER); } TalkApiClient(Context applicationContext, @NonNull Uri apiBaseUrl); @VisibleForTesting  TalkApiClient(
            @NonNull Uri apiBaseUrl,
            @NonNull ChannelServiceHttpClient httpClient); @NonNull LineApiResponse<LineProfile> getProfile(@NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<LineFriendshipStatus> getFriendshipStatus(@NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<GetFriendsResponse> getFriends(
            @NonNull InternalAccessToken accessToken,
            @NonNull FriendSortField sortField,
            @Nullable String pageToken,
            boolean isForOttShareMessage); @NonNull LineApiResponse<GetGroupsResponse> getGroups(
            @NonNull InternalAccessToken accessToken,
            @Nullable String pageToken,
            boolean isForOttShareMessage); @NonNull LineApiResponse<GetFriendsResponse> getFriendsApprovers(
            @NonNull InternalAccessToken accessToken,
            @NonNull FriendSortField sortField,
            @Nullable String nextPageRequestToken); @NonNull LineApiResponse<GetFriendsResponse> getGroupApprovers(
            @NonNull InternalAccessToken accessToken,
            @NonNull String groupId,
            @Nullable String nextPageRequestToken); @NonNull LineApiResponse<String> sendMessage(
            @NonNull InternalAccessToken accessToken,
            @NonNull String targetUserId,
            @NonNull List<MessageData> messages); @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull InternalAccessToken accessToken,
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages); @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull InternalAccessToken accessToken,
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages,
            boolean isOttUsed); @NonNull LineApiResponse<Boolean> getOpenChatAgreementStatus(
            @NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<OpenChatRoomInfo> createOpenChatRoom(
            @NonNull InternalAccessToken accessToken,
            @NonNull OpenChatParameters openChatParameters); @NonNull LineApiResponse<Boolean> joinOpenChatRoom(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId,
            @NonNull String displayName); @NonNull LineApiResponse<OpenChatRoomStatus> getOpenChatRoomStatus(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId); @NonNull LineApiResponse<MembershipStatus> getOpenChatMembershipStatus(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId); @NonNull LineApiResponse<OpenChatRoomJoinType> getOpenChatRoomJoinType(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId); }
TalkApiClient { @VisibleForTesting @NonNull protected LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsersUsingOtt( @NonNull InternalAccessToken accessToken, @NonNull String ott, @NonNull List<MessageData> messages) { String postData; try { postData = MessageSendRequest.createOttType(ott, messages).toJsonString(); } catch (JSONException e) { return createInternalErrorResponse(e); } return httpClient.postWithJson( buildUri(apiBaseUrl, BASE_PATH_MESSAGE_API, PATH_OTT_SHARE), buildRequestHeaders(accessToken), postData, MULTI_SEND_RESPONSE_PARSER); } TalkApiClient(Context applicationContext, @NonNull Uri apiBaseUrl); @VisibleForTesting  TalkApiClient(
            @NonNull Uri apiBaseUrl,
            @NonNull ChannelServiceHttpClient httpClient); @NonNull LineApiResponse<LineProfile> getProfile(@NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<LineFriendshipStatus> getFriendshipStatus(@NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<GetFriendsResponse> getFriends(
            @NonNull InternalAccessToken accessToken,
            @NonNull FriendSortField sortField,
            @Nullable String pageToken,
            boolean isForOttShareMessage); @NonNull LineApiResponse<GetGroupsResponse> getGroups(
            @NonNull InternalAccessToken accessToken,
            @Nullable String pageToken,
            boolean isForOttShareMessage); @NonNull LineApiResponse<GetFriendsResponse> getFriendsApprovers(
            @NonNull InternalAccessToken accessToken,
            @NonNull FriendSortField sortField,
            @Nullable String nextPageRequestToken); @NonNull LineApiResponse<GetFriendsResponse> getGroupApprovers(
            @NonNull InternalAccessToken accessToken,
            @NonNull String groupId,
            @Nullable String nextPageRequestToken); @NonNull LineApiResponse<String> sendMessage(
            @NonNull InternalAccessToken accessToken,
            @NonNull String targetUserId,
            @NonNull List<MessageData> messages); @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull InternalAccessToken accessToken,
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages); @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull InternalAccessToken accessToken,
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages,
            boolean isOttUsed); @NonNull LineApiResponse<Boolean> getOpenChatAgreementStatus(
            @NonNull InternalAccessToken accessToken); @NonNull LineApiResponse<OpenChatRoomInfo> createOpenChatRoom(
            @NonNull InternalAccessToken accessToken,
            @NonNull OpenChatParameters openChatParameters); @NonNull LineApiResponse<Boolean> joinOpenChatRoom(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId,
            @NonNull String displayName); @NonNull LineApiResponse<OpenChatRoomStatus> getOpenChatRoomStatus(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId); @NonNull LineApiResponse<MembershipStatus> getOpenChatMembershipStatus(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId); @NonNull LineApiResponse<OpenChatRoomJoinType> getOpenChatRoomJoinType(
            @NonNull InternalAccessToken accessToken,
            @NonNull String roomId);  }