### Question:
LineApiClientImpl implements LineApiClient { @Override @TokenAutoRefresh @NonNull public LineApiResponse<LineProfile> getProfile() { return callWithAccessToken(talkApiClient::getProfile); } LineApiClientImpl(
            @NonNull String channelId,
            @NonNull LineAuthenticationApiClient oauthApiClient,
            @NonNull TalkApiClient talkApiClient,
            @NonNull AccessTokenCache accessTokenCache); @Override @NonNull LineApiResponse<?> logout(); @Override @NonNull LineApiResponse<LineAccessToken> refreshAccessToken(); @Override @NonNull LineApiResponse<LineCredential> verifyToken(); @Override @NonNull LineApiResponse<LineAccessToken> getCurrentAccessToken(); @Override @TokenAutoRefresh @NonNull LineApiResponse<LineProfile> getProfile(); @Override @TokenAutoRefresh @NonNull LineApiResponse<LineFriendshipStatus> getFriendshipStatus(); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetFriendsResponse> getFriends(
            @NonNull FriendSortField sort,
            @Nullable String nextPageRequestToken); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetFriendsResponse> getFriends(
            @NonNull FriendSortField sort,
            @Nullable String nextPageRequestToken,
            boolean isForOttShareMessage); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetFriendsResponse> getFriendsApprovers(
            FriendSortField sort,
            @Nullable String nextPageRequestToken); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetGroupsResponse> getGroups(@Nullable String nextPageRequestToken); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetGroupsResponse> getGroups(
            @Nullable String nextPageRequestToken,
            boolean isForOttShareMessage); @Override @TokenAutoRefresh @NonNull LineApiResponse<GetFriendsResponse> getGroupApprovers(
            @NonNull String groupId,
            @Nullable String nextPageRequestToken); @Override @TokenAutoRefresh @NonNull LineApiResponse<String> sendMessage(
            @NonNull String targetUserId,
            @NonNull List<MessageData> messages); @Override @TokenAutoRefresh @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages); @Override @TokenAutoRefresh @NonNull LineApiResponse<List<SendMessageResponse>> sendMessageToMultipleUsers(
            @NonNull List<String> targetUserIds,
            @NonNull List<MessageData> messages,
            boolean isOttUsed); @NonNull LineApiResponse<Boolean> getOpenChatAgreementStatus(); @NonNull LineApiResponse<OpenChatRoomInfo> createOpenChatRoom(@NonNull OpenChatParameters openChatParameters); @NonNull LineApiResponse<Boolean> joinOpenChatRoom(@NonNull String roomId, @NonNull String displayName); @NonNull LineApiResponse<OpenChatRoomStatus> getOpenChatRoomStatus(@NonNull String roomId); @NonNull LineApiResponse<MembershipStatus> getOpenChatMembershipStatus(@NonNull String roomId); @NonNull LineApiResponse<OpenChatRoomJoinType> getOpenChatRoomJoinType(@NonNull String roomId);  }### Answer:
@Test public void testGetProfile() { LineApiResponse<LineProfile> expectedResponse = LineApiResponse.createAsSuccess(PROFILE); doReturn(expectedResponse) .when(internalTalkApiClient) .getProfile(any(InternalAccessToken.class)); accessTokenCache.saveAccessToken(ACCESS_TOKEN); LineApiResponse<LineProfile> actualResponse = target.getProfile(); assertSame(expectedResponse, actualResponse); verify(internalTalkApiClient, times(1)).getProfile(ACCESS_TOKEN); }
@Test public void testGetProfileWithApiCallError() { LineApiResponse<LineProfile> expectedResponse = LineApiResponse.createAsError( LineApiResponseCode.INTERNAL_ERROR, LineApiError.DEFAULT); doReturn(expectedResponse) .when(internalTalkApiClient) .getProfile(any(InternalAccessToken.class)); accessTokenCache.saveAccessToken(ACCESS_TOKEN); LineApiResponse<LineProfile> actualResponse = target.getProfile(); assertSame(expectedResponse, actualResponse); verify(internalTalkApiClient, times(1)).getProfile(ACCESS_TOKEN); }
@Test public void testGetProfileWithNoAccessToken() { LineApiResponse<?> response = target.getProfile(); assertFalse(response.isSuccess()); assertSame(response.getResponseCode(), LineApiResponseCode.INTERNAL_ERROR); }