@Test public void testGetGroups_shareMessageWithOtt() { doReturn(EXPECTED_RESULT).when(httpClient).get( any(Uri.class), anyMapOf(String.class, String.class), anyMapOf(String.class, String.class), any(ResponseDataParser.class)); LineApiResponse<GetGroupsResponse> actualResult = target.getGroups(ACCESS_TOKEN, "pageToken01", true); assertSame(EXPECTED_RESULT, actualResult); Map<String, String> expectedQueryParams = new HashMap<>(); expectedQueryParams.put("pageToken", "pageToken01"); verify(httpClient, times(1)).get( eq(Uri.parse(API_BASE_URL + "/" + BASE_PATH_GRAPH_API + "/" + PATH_OTS_GROUPS)), eq(Collections.singletonMap("Authorization", "Bearer " + ACCESS_TOKEN.getAccessToken())), eq(expectedQueryParams), responseParserCaptor.capture()); assertTrue(responseParserCaptor.getValue() instanceof TalkApiClient.GroupParser); }
@NonNull public LineApiResponse<GetGroupsResponse> getGroups( @NonNull InternalAccessToken accessToken, @Nullable String pageToken, boolean isForOttShareMessage) { final String pathSegment = (isForOttShareMessage) ? PATH_OTS_GROUPS : PATH_GROUPS; final Uri uri = buildUri(apiBaseUrl, BASE_PATH_GRAPH_API, pathSegment); final Map<String, String> queryParams; if (!TextUtils.isEmpty(pageToken)) { queryParams = buildParams("pageToken", pageToken); } else { queryParams = Collections.emptyMap(); } return httpClient.get( uri, buildRequestHeaders(accessToken), queryParams, GROUP_PARSER); }
TalkApiClient { @NonNull public LineApiResponse<GetGroupsResponse> getGroups( @NonNull InternalAccessToken accessToken, @Nullable String pageToken, boolean isForOttShareMessage) { final String pathSegment = (isForOttShareMessage) ? PATH_OTS_GROUPS : PATH_GROUPS; final Uri uri = buildUri(apiBaseUrl, BASE_PATH_GRAPH_API, pathSegment); final Map<String, String> queryParams; if (!TextUtils.isEmpty(pageToken)) { queryParams = buildParams("pageToken", pageToken); } else { queryParams = Collections.emptyMap(); } return httpClient.get( uri, buildRequestHeaders(accessToken), queryParams, GROUP_PARSER); } }
TalkApiClient { @NonNull public LineApiResponse<GetGroupsResponse> getGroups( @NonNull InternalAccessToken accessToken, @Nullable String pageToken, boolean isForOttShareMessage) { final String pathSegment = (isForOttShareMessage) ? PATH_OTS_GROUPS : PATH_GROUPS; final Uri uri = buildUri(apiBaseUrl, BASE_PATH_GRAPH_API, pathSegment); final Map<String, String> queryParams; if (!TextUtils.isEmpty(pageToken)) { queryParams = buildParams("pageToken", pageToken); } else { queryParams = Collections.emptyMap(); } return httpClient.get( uri, buildRequestHeaders(accessToken), queryParams, GROUP_PARSER); } TalkApiClient(Context applicationContext, @NonNull Uri apiBaseUrl); @VisibleForTesting  TalkApiClient(
            @NonNull Uri apiBaseUrl,
            @NonNull ChannelServiceHttpClient httpClient); }
TalkApiClient { @NonNull public LineApiResponse<GetGroupsResponse> getGroups( @NonNull InternalAccessToken accessToken, @Nullable String pageToken, boolean isForOttShareMessage) { final String pathSegment = (isForOttShareMessage) ? PATH_OTS_GROUPS : PATH_GROUPS; final Uri uri = buildUri(apiBaseUrl, BASE_PATH_GRAPH_API, pathSegment); final Map<String, String> queryParams; if (!TextUtils.isEmpty(pageToken)) { queryParams = buildParams("pageToken", pageToken); } else { queryParams = Collections.emptyMap(); } return httpClient.get( uri, buildRequestHeaders(accessToken), queryParams, GROUP_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 { @NonNull public LineApiResponse<GetGroupsResponse> getGroups( @NonNull InternalAccessToken accessToken, @Nullable String pageToken, boolean isForOttShareMessage) { final String pathSegment = (isForOttShareMessage) ? PATH_OTS_GROUPS : PATH_GROUPS; final Uri uri = buildUri(apiBaseUrl, BASE_PATH_GRAPH_API, pathSegment); final Map<String, String> queryParams; if (!TextUtils.isEmpty(pageToken)) { queryParams = buildParams("pageToken", pageToken); } else { queryParams = Collections.emptyMap(); } return httpClient.get( uri, buildRequestHeaders(accessToken), queryParams, GROUP_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);  }