diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java
index 4e48332..a66dacd 100644
--- a/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/BpfDumpTest.java
@@ -57,8 +57,8 @@
 
     @Test
     public void testToBase64EncodedString() {
-        final Struct.U32 key = new Struct.U32(TEST_KEY);
-        final Struct.U32 value = new Struct.U32(TEST_VAL);
+        final Struct.S32 key = new Struct.S32(TEST_KEY);
+        final Struct.S32 value = new Struct.S32(TEST_VAL);
 
         // Verified in python:
         //   import base64
@@ -71,15 +71,15 @@
 
     @Test
     public void testFromBase64EncodedString() {
-        Pair<Struct.U32, Struct.U32> decodedKeyValue = BpfDump.fromBase64EncodedString(
-                Struct.U32.class, Struct.U32.class, TEST_KEY_VAL_BASE64);
+        Pair<Struct.S32, Struct.S32> decodedKeyValue = BpfDump.fromBase64EncodedString(
+                Struct.S32.class, Struct.S32.class, TEST_KEY_VAL_BASE64);
         assertEquals(TEST_KEY, decodedKeyValue.first.val);
         assertEquals(TEST_VAL, decodedKeyValue.second.val);
     }
 
     private void assertThrowsIllegalArgumentException(final String testStr) {
         assertThrows(IllegalArgumentException.class,
-                () -> BpfDump.fromBase64EncodedString(Struct.U32.class, Struct.U32.class, testStr));
+                () -> BpfDump.fromBase64EncodedString(Struct.S32.class, Struct.S32.class, testStr));
     }
 
     @Test
@@ -96,7 +96,7 @@
                 TEST_KEY_VAL_BASE64 + BASE64_DELIMITER + TEST_KEY_BASE64);
     }
 
-    private String getDumpMap(final IBpfMap<Struct.U32, Struct.U32> map) {
+    private String getDumpMap(final IBpfMap<Struct.S32, Struct.S32> map) {
         final StringWriter sw = new StringWriter();
         BpfDump.dumpMap(map, new PrintWriter(sw), "mapName", "header",
                 (key, val) -> "key=" + key.val + ", val=" + val.val);
@@ -105,9 +105,9 @@
 
     @Test
     public void testDumpMap() throws Exception {
-        final IBpfMap<Struct.U32, Struct.U32> map =
-                new TestBpfMap<>(Struct.U32.class, Struct.U32.class);
-        map.updateEntry(new Struct.U32(123), new Struct.U32(456));
+        final IBpfMap<Struct.S32, Struct.S32> map =
+                new TestBpfMap<>(Struct.S32.class, Struct.S32.class);
+        map.updateEntry(new Struct.S32(123), new Struct.S32(456));
 
         final String dump = getDumpMap(map);
         assertEquals(dump, "mapName:\n"
@@ -117,10 +117,10 @@
 
     @Test
     public void testDumpMapMultipleEntries() throws Exception {
-        final IBpfMap<Struct.U32, Struct.U32> map =
-                new TestBpfMap<>(Struct.U32.class, Struct.U32.class);
-        map.updateEntry(new Struct.U32(123), new Struct.U32(456));
-        map.updateEntry(new Struct.U32(789), new Struct.U32(123));
+        final IBpfMap<Struct.S32, Struct.S32> map =
+                new TestBpfMap<>(Struct.S32.class, Struct.S32.class);
+        map.updateEntry(new Struct.S32(123), new Struct.S32(456));
+        map.updateEntry(new Struct.S32(789), new Struct.S32(123));
 
         final String dump = getDumpMap(map);
         assertTrue(dump.contains("mapName:"));
@@ -129,7 +129,7 @@
         assertTrue(dump.contains("key=789, val=123"));
     }
 
-    private String getDumpMapStatus(final IBpfMap<Struct.U32, Struct.U32> map) {
+    private String getDumpMapStatus(final IBpfMap<Struct.S32, Struct.S32> map) {
         final StringWriter sw = new StringWriter();
         BpfDump.dumpMapStatus(map, new PrintWriter(sw), "mapName", "mapPath");
         return sw.toString();
@@ -137,8 +137,8 @@
 
     @Test
     public void testGetMapStatus() {
-        final IBpfMap<Struct.U32, Struct.U32> map =
-                new TestBpfMap<>(Struct.U32.class, Struct.U32.class);
+        final IBpfMap<Struct.S32, Struct.S32> map =
+                new TestBpfMap<>(Struct.S32.class, Struct.S32.class);
         assertEquals("mapName: OK\n", getDumpMapStatus(map));
     }
 
