Skip to content

Commit

Permalink
Test: Change allow nulls parameter with with empty on cmts mapper test
Browse files Browse the repository at this point in the history
Also, this 'SameParameterValue' warning got suppressed for the
'getDefaultCommentList(...)' function as it is currently being used once
and as 'getDefaultCommentList(false)'. How this doesn't mean it will not
be used in the future, or wasn't used in the past. As such, keeping this
method signature and suppressing this warning for the time being seems
to be the better approach here.

Related PR Comment: https://github.com/wordpress-mobile/
WordPress-FluxC-Android/pull/2868#discussion_r1362018044
  • Loading branch information
ParaskP7 committed Oct 17, 2023
1 parent 2e855cd commit 49bded0
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,32 +189,33 @@ class CommentsMapperTest {
)
}

private fun getDefaultComment(allowNulls: Boolean): CommentEntity {
private fun getDefaultComment(withEmpty: Boolean): CommentEntity {
return CommentEntity(
id = 0L,
remoteCommentId = 10L,
remotePostId = 100L,
authorId = 44L,
localSiteId = 10_000,
remoteSiteId = 100_000L,
authorUrl = if (allowNulls) "" else "https://test-debug-site.wordpress.com",
authorName = if (allowNulls) "" else "authorname",
authorEmail = if (allowNulls) "" else "[email protected]",
authorProfileImageUrl = if (allowNulls) "" else "https://gravatar.com/avatar/111222333",
postTitle = if (allowNulls) "" else "again",
authorUrl = if (withEmpty) "" else "https://test-debug-site.wordpress.com",
authorName = if (withEmpty) "" else "authorname",
authorEmail = if (withEmpty) "" else "[email protected]",
authorProfileImageUrl = if (withEmpty) "" else "https://gravatar.com/avatar/111222333",
postTitle = if (withEmpty) "" else "again",
status = APPROVED.toString(),
datePublished = if (allowNulls) "" else "2021-05-12T15:10:40+02:00",
datePublished = if (withEmpty) "" else "2021-05-12T15:10:40+02:00",
publishedTimestamp = 1_000_000,
content = if (allowNulls) "" else "content example",
url = if (allowNulls) "" else "https://test-debug-site.wordpress.com/2021/02/25/again/#comment-137",
content = if (withEmpty) "" else "content example",
url = if (withEmpty) "" else "https://test-debug-site.wordpress.com/2021/02/25/again/#comment-137",
hasParent = true,
parentId = 1_000L,
iLike = false
)
}

private fun getDefaultCommentList(allowNulls: Boolean): CommentEntityList {
val comment = getDefaultComment(allowNulls)
@Suppress("SameParameterValue")
private fun getDefaultCommentList(withEmpty: Boolean): CommentEntityList {
val comment = getDefaultComment(withEmpty)
return listOf(
comment.copy(id = 1L, remoteCommentId = 10L, datePublished = "2021-07-24T00:51:43+02:00"),
comment.copy(id = 2L, remoteCommentId = 20L, datePublished = "2021-07-24T00:51:43+02:00"),
Expand Down

0 comments on commit 49bded0

Please sign in to comment.