Skip to content

Commit

Permalink
Remove unnecessary PrepareForTest annotation classes
Browse files Browse the repository at this point in the history
Summary: When a test for a class prepares the class to be tested, testing coverage computation is broken. This change fixes this for some classes - in which we were unnecessarily preparing the class for testing.

Reviewed By: linmx0130

Differential Revision: D36217726

fbshipit-source-id: 730e43df183a77710d2f9270fcb2b6b78a6ce6f0
  • Loading branch information
ZacharyClarkMartin authored and facebook-github-bot committed May 10, 2022
1 parent 7469683 commit b55e190
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.junit.Test
import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest

@PrepareForTest(FacebookSdk::class, PKCEUtil::class)
@PrepareForTest(FacebookSdk::class)
class PKCEUtilTest : FacebookPowerMockTestCase() {
// 128 characters valid code verifier
val VALID_CODE_VERIFIER =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.reflect.Whitebox
import org.powermock.reflect.internal.WhiteboxImpl

@PrepareForTest(AppEventCollection::class, FacebookSdk::class)
@PrepareForTest(FacebookSdk::class)
class AppEventCollectionTest : FacebookPowerMockTestCase() {

private val mockExecutor = FacebookSerialExecutor()

private lateinit var appEventCollection: AppEventCollection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.powermock.core.classloader.annotations.PrepareForTest

@PrepareForTest(PersistedEvents::class)
class PersistedEventsTest : FacebookPowerMockTestCase() {

private lateinit var persistedEvents: PersistedEvents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ import org.assertj.core.api.Assertions.assertThat
import org.junit.Before
import org.junit.Test
import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest

@PrepareForTest(ViewHierarchy::class)
class ViewHierarchyTest : CodelessTestBase() {
private lateinit var mockView: View
private lateinit var mockTestNestedScrollingChild: TestNestedScrollingChild
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import org.powermock.reflect.Whitebox
FacebookSdk::class,
AutomaticAnalyticsLogger::class,
InternalAppEventsLogger::class,
InAppPurchaseActivityLifecycleTracker::class,
InAppPurchaseEventManager::class,
InAppPurchaseUtils::class)
class InAppPurchaseActivityLifecycleTrackerTest : FacebookPowerMockTestCase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.facebook.appevents.iap.InAppPurchaseUtils.invokeMethod
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.anyOrNull
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.spy
import com.nhaarman.mockitokotlin2.whenever
import java.lang.reflect.Method
import java.util.concurrent.Executor
Expand All @@ -39,8 +38,7 @@ import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.reflect.Whitebox

@PrepareForTest(
FacebookSdk::class, InAppPurchaseBillingClientWrapper::class, InAppPurchaseUtils::class)
@PrepareForTest(FacebookSdk::class, InAppPurchaseUtils::class)
class InAppPurchaseBillingClientWrapperTest : FacebookPowerMockTestCase() {
private val mockExecutor: Executor = FacebookSerialExecutor()
private lateinit var inAppPurchaseBillingClientWrapper: InAppPurchaseBillingClientWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.powermock.api.mockito.PowerMockito
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.reflect.Whitebox

@PrepareForTest(FacebookSdk::class, InAppPurchaseLoggerManager::class)
@PrepareForTest(FacebookSdk::class)
class InAppPurchaseLoggerManagerTest : FacebookPowerMockTestCase() {
private val mockExecutor: Executor = FacebookSerialExecutor()
private lateinit var mockPrefs: SharedPreferences
Expand Down

0 comments on commit b55e190

Please sign in to comment.