Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jul 8, 2025

  • Move permission rules and content provider client setup to JUnit rules
  • Use BuildConfig.APPLICATION_ID for test account types
  • Deprecate ical4jTimeZone function

@rfc2822 rfc2822 self-assigned this Jul 8, 2025
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Jul 8, 2025
@rfc2822 rfc2822 requested a review from Copilot July 8, 2025 12:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors the test setup and teardown across various Android instrumentation tests by replacing static before/after hooks with JUnit rules, standardizing test account types, and marking an old utility function as deprecated.

  • Moved permission granting and content provider client setup into JUnit @Rule, @Before, and @After methods
  • Replaced hard-coded package names in test accounts with BuildConfig.APPLICATION_ID (except where noted)
  • Deprecated the ical4jTimeZone helper in DateUtils

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/src/main/kotlin/at/bitfire/ical4android/util/DateUtils.kt Marked ical4jTimeZone as deprecated with a guidance message
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/calendar/AndroidCalendarTest.kt Removed static rule setup, added instance-level @Rule, @Before and @After methods
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/TasksBatchOperationTest.kt Updated test account type to BuildConfig.APPLICATION_ID
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/JtxBatchOperationTest.kt Updated test account type to BuildConfig.APPLICATION_ID
lib/src/androidTest/kotlin/at/bitfire/synctools/storage/ContactsBatchOperationTest.kt Updated test account type to BuildConfig.APPLICATION_ID
lib/src/androidTest/kotlin/at/bitfire/synctools/LoggingTestRunner.kt Switched log handler to use BuildConfig.LIBRARY_PACKAGE_NAME
lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidEventTest.kt Replaced class-level setup with InitCalendarProviderRule, moved client setup/teardown to @Before/@After, and adjusted version check logic
Comments suppressed due to low confidence (3)

lib/src/androidTest/kotlin/at/bitfire/synctools/storage/calendar/AndroidCalendarTest.kt:38

  • [nitpick] Consider using BuildConfig.APPLICATION_ID for the account type here to align with other tests and avoid hardcoding.
    private val testAccount = Account("ical4android.AndroidCalendarTest", CalendarContract.ACCOUNT_TYPE_LOCAL)

lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidEventTest.kt:88

  • The call to getInstrumentation() is undefined in this context; use InstrumentationRegistry.getInstrumentation() instead.
        val context = getInstrumentation().targetContext

lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidEventTest.kt:75

  • [nitpick] To stay consistent with other tests and avoid hardcoded strings, use BuildConfig.APPLICATION_ID for the account type.
    private val testAccount = Account("[email protected]", ACCOUNT_TYPE_LOCAL)

- Move permission rules and content provider client setup to JUnit rules
- Use BuildConfig.APPLICATION_ID for test account types
- Deprecate ical4jTimeZone function
@rfc2822 rfc2822 marked this pull request as ready for review July 8, 2025 12:36
@rfc2822 rfc2822 merged commit 1d02c48 into main Jul 8, 2025
8 checks passed
@rfc2822 rfc2822 deleted the rewrite1 branch July 8, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant