Skip to content

Conversation

malinajirka
Copy link
Contributor

Fixes #11285

Adds unit tests for UploadUtils.getErrorMessageResIdFromPostError method.

To test:

  • This PR doesn't need to be manually tested.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.


@Test
fun `getErrorMessageResIdFromPostError on generic error and published post eligible for auto upload`() {
verifyGenericError(false, PUBLISHED,true, R.string.error_post_not_published_retrying)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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)


@Test
fun `getErrorMessageResIdFromPostError on generic error and PENDING post NOT eligible for auto upload`() {
verifyGenericError(false, PENDING,false, R.string.error_post_not_submitted)
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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)

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 25, 2020

You can test the changes on this Pull Request by downloading the APK here.

Copy link
Contributor

@jd-alexander jd-alexander left a 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 🚢

@jd-alexander jd-alexander merged commit 4d8f6db into feature/master-pages-offline-support Feb 25, 2020
@jd-alexander jd-alexander deleted the issue/11285-test-upload-utils-post-msgs branch February 25, 2020 21:11
@malinajirka malinajirka modified the milestones: 14.4 ❄️, 14.6 Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants