Do not verify field count in tests used in CTS
Tests in tests/common and tests/cts are run as part of CtsNetTestCases. Many used assertFieldCountEquals in parceling/unparceling tests to ensure that unexpected fields were not added, or that they were not missed when testing parceling/unparceling. However with many of the classes updatable through module updates, the field count may change in the future, breaking CTS tests. Stop checking for the field count, as it would break on module releases, and its value is lower than the maintenance cost. Bug: 205901761 Test: atest CtsNetTestCases Change-Id: I79854741f7e834574d4825bb737ef507785310fe
This commit is contained in:
@@ -28,7 +28,6 @@ import static android.system.OsConstants.RT_SCOPE_SITE;
|
||||
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
|
||||
|
||||
import static com.android.testutils.MiscAsserts.assertEqualBothWays;
|
||||
import static com.android.testutils.MiscAsserts.assertFieldCountEquals;
|
||||
import static com.android.testutils.MiscAsserts.assertNotEqualEitherWay;
|
||||
import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;
|
||||
|
||||
@@ -45,7 +44,6 @@ import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.testutils.DevSdkIgnoreRule;
|
||||
import com.android.testutils.DevSdkIgnoreRule.IgnoreAfter;
|
||||
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
|
||||
|
||||
import org.junit.Rule;
|
||||
@@ -352,17 +350,6 @@ public class LinkAddressTest {
|
||||
assertParcelingIsLossless(l);
|
||||
}
|
||||
|
||||
@Test @IgnoreAfter(Build.VERSION_CODES.Q)
|
||||
public void testFieldCount_Q() {
|
||||
assertFieldCountEquals(4, LinkAddress.class);
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||
public void testFieldCount() {
|
||||
// Make sure any new field is covered by the above parceling tests when changing this number
|
||||
assertFieldCountEquals(6, LinkAddress.class);
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||
public void testDeprecationTime() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user