Skip to content

Commit 7f5e6d3

Browse files
committed
[fix](test) Fix compile error in ReplicaTest: cannot instantiate abstract Replica
The testBaseReplicaSchemaHashReturnsNegativeOne test tried to instantiate abstract class Replica directly, causing a compile error. Merged the no-op setSchemaHash assertion into the existing CloudReplica test, which exercises the same base-class code paths since CloudReplica inherits getSchemaHash()/setSchemaHash() without overriding them. Generated by ThinkOps
1 parent 8711734 commit 7f5e6d3

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

fe/fe-core/src/test/java/org/apache/doris/catalog/ReplicaTest.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,23 +214,16 @@ public void testLocalReplicaSetSchemaHash() {
214214
Assert.assertEquals(222, localReplica.getSchemaHash());
215215
}
216216

217-
@Test
218-
public void testBaseReplicaSchemaHashReturnsNegativeOne() {
219-
// Base Replica (and by extension CloudReplica) should return -1 for schemaHash
220-
// since schemaHash is only meaningful for LocalReplica
221-
Replica baseReplica = new Replica();
222-
Assert.assertEquals(-1, baseReplica.getSchemaHash());
223-
224-
// setSchemaHash is a no-op on base Replica
225-
baseReplica.setSchemaHash(999);
226-
Assert.assertEquals(-1, baseReplica.getSchemaHash());
227-
}
228-
229217
@Test
230218
public void testCloudReplicaSchemaHashReturnsNegativeOne() {
231-
// CloudReplica extends Replica (not LocalReplica), so it inherits the -1 stub
219+
// CloudReplica extends Replica (not LocalReplica), so it inherits the base -1 stub.
220+
// schemaHash=12345 is passed to the constructor but ignored by the base class.
232221
CloudReplica cloudReplica = new CloudReplica(10000L, 20000L, ReplicaState.NORMAL,
233222
3, 12345, 1, 2, 3, 4, -1);
234223
Assert.assertEquals(-1, cloudReplica.getSchemaHash());
224+
225+
// setSchemaHash is a no-op on base Replica, so CloudReplica stays at -1
226+
cloudReplica.setSchemaHash(999);
227+
Assert.assertEquals(-1, cloudReplica.getSchemaHash());
235228
}
236229
}

0 commit comments

Comments
 (0)