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:
@@ -23,10 +23,9 @@ import android.os.Build
|
||||
import androidx.test.filters.SmallTest
|
||||
import androidx.test.runner.AndroidJUnit4
|
||||
import com.android.testutils.assertEqualBothWays
|
||||
import com.android.testutils.assertFieldCountEquals
|
||||
import com.android.testutils.assertParcelSane
|
||||
import com.android.testutils.DevSdkIgnoreRule
|
||||
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo
|
||||
import com.android.testutils.assertParcelingIsLossless
|
||||
import com.android.testutils.parcelingRoundTrip
|
||||
import java.net.InetAddress
|
||||
import org.junit.Assert.assertEquals
|
||||
@@ -93,7 +92,7 @@ class NattKeepalivePacketDataTest {
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||
fun testParcel() {
|
||||
assertParcelSane(nattKeepalivePacket(), 0)
|
||||
assertParcelingIsLossless(nattKeepalivePacket())
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||
@@ -103,8 +102,6 @@ class NattKeepalivePacketDataTest {
|
||||
assertNotEquals(nattKeepalivePacket(srcAddress = TEST_DST_ADDRV4), nattKeepalivePacket())
|
||||
// Test src port only because dst port have to be NATT_PORT
|
||||
assertNotEquals(nattKeepalivePacket(srcPort = TEST_PORT2), nattKeepalivePacket())
|
||||
// Make sure the parceling test is updated if fields are added in the base class.
|
||||
assertFieldCountEquals(5, KeepalivePacketData::class.java)
|
||||
}
|
||||
|
||||
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||
|
||||
Reference in New Issue
Block a user