Skip to content

Commit 6083321

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 dff3619 commit 6083321

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
@@ -213,23 +213,16 @@ public void testLocalReplicaSetSchemaHash() {
213213
Assert.assertEquals(222, localReplica.getSchemaHash());
214214
}
215215

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

0 commit comments

Comments
 (0)