-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add unit tests for UploadUtils getErrorMessageResId #11379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests for UploadUtils getErrorMessageResId #11379
Conversation
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published post eligible for auto upload`() { | ||
verifyGenericError(false, PUBLISHED,true, R.string.error_post_not_published_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L92
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published page eligible for auto upload`() { | ||
verifyGenericError(true, PUBLISHED,true, R.string.error_page_not_published_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L97
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published page eligible for auto upload`() { | ||
verifyGenericError(true, PUBLISHED,true, R.string.error_page_not_published_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L97
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private post eligible for auto upload`() { | ||
verifyGenericError(false, PRIVATE,true, R.string.error_post_not_published_retrying_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L102
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private page eligible for auto upload`() { | ||
verifyGenericError(true, PRIVATE,true, R.string.error_page_not_published_retrying_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L107
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private page eligible for auto upload`() { | ||
verifyGenericError(true, PRIVATE,true, R.string.error_page_not_published_retrying_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L107
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT post eligible for auto upload`() { | ||
verifyGenericError(false, DRAFT,true, R.string.error_generic_error_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L112
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT page eligible for auto upload`() { | ||
verifyGenericError(true, DRAFT,true, R.string.error_generic_error_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L117
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT page eligible for auto upload`() { | ||
verifyGenericError(true, DRAFT,true, R.string.error_generic_error_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L117
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and SCHEDULED post eligible for auto upload`() { | ||
verifyGenericError(false, SCHEDULED,true, R.string.error_post_not_scheduled_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L122
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and SCHEDULED page eligible for auto upload`() { | ||
verifyGenericError(true, SCHEDULED,true, R.string.error_page_not_scheduled_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L127
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and SCHEDULED page eligible for auto upload`() { | ||
verifyGenericError(true, SCHEDULED,true, R.string.error_page_not_scheduled_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L127
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and PENDING post eligible for auto upload`() { | ||
verifyGenericError(false, PENDING,true, R.string.error_post_not_submitted_retrying) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L132
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published post NOT eligible for auto upload`() { | ||
verifyGenericError(false, PUBLISHED,false, R.string.error_post_not_published) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L142
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published page NOT eligible for auto upload`() { | ||
verifyGenericError(true, PUBLISHED,false, R.string.error_page_not_published) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L147
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and published page NOT eligible for auto upload`() { | ||
verifyGenericError(true, PUBLISHED,false, R.string.error_page_not_published) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L147
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private post NOT eligible for auto upload`() { | ||
verifyGenericError(false, PRIVATE,false, R.string.error_post_not_published_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L152
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private page NOT eligible for auto upload`() { | ||
verifyGenericError(true, PRIVATE,false, R.string.error_page_not_published_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L157
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and private page NOT eligible for auto upload`() { | ||
verifyGenericError(true, PRIVATE,false, R.string.error_page_not_published_private) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L157
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT post NOT eligible for auto upload`() { | ||
verifyGenericError(false, DRAFT,false, R.string.error_generic_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L162
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT page NOT eligible for auto upload`() { | ||
verifyGenericError(true, DRAFT,false, R.string.error_generic_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L167
Unnecessary space(s)
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and DRAFT page NOT eligible for auto upload`() { | ||
verifyGenericError(true, DRAFT,false, R.string.error_generic_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L167
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and SCHEDULED post NOT eligible for auto upload`() { | ||
verifyGenericError(false, SCHEDULED,false, R.string.error_post_not_scheduled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L172
Missing spacing after ","
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and SCHEDULED page NOT eligible for auto upload`() { | ||
verifyGenericError(true, SCHEDULED,false, R.string.error_page_not_scheduled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: no-multi-spaces
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L177
Unnecessary space(s)
WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt
Outdated
Show resolved
Hide resolved
|
||
@Test | ||
fun `getErrorMessageResIdFromPostError on generic error and PENDING post NOT eligible for auto upload`() { | ||
verifyGenericError(false, PENDING,false, R.string.error_post_not_submitted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: comma-spacing
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L182
Missing spacing after ","
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: parameter-list-wrapping
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Parameter should be on a separate line (unless all parameters can fit a single line)
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: parameter-list-wrapping
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Parameter should be on a separate line (unless all parameters can fit a single line)
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: parameter-list-wrapping
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Parameter should be on a separate line (unless all parameters can fit a single line)
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: parameter-list-wrapping
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Parameter should be on a separate line (unless all parameters can fit a single line)
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: parameter-list-wrapping
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Missing newline before ")"
verifyGenericError(true, PENDING, false, R.string.error_page_not_submitted) | ||
} | ||
|
||
private fun verifyGenericError(isPage: Boolean, postStatus: PostStatus, isEligibleForAutoUpload: Boolean, resId: Int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reporter: Checkstyle
Rule: max-line-length
Severity: ERROR
File: /home/circleci/project/WordPress/src/test/java/org/wordpress/android/ui/uploads/UploadUtilsTest.kt L190
Exceeded max line length (120) (cannot be auto-corrected)
You can test the changes on this Pull Request by downloading the APK here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @malinajirka! Love the use of the verifyGenericError
function so that the code isn't duplicated. LGTM 🚢
Fixes #11285
Adds unit tests for UploadUtils.getErrorMessageResIdFromPostError method.
To test:
PR submission checklist:
RELEASE-NOTES.txt
if necessary.