@Test
public void testDeleteTableSegment() {
MockConnectionFactory factory = new MockConnectionFactory();
CompletableFuture<Boolean> result = helper.deleteTableSegment("", "", true, new MockHostControllerStore(),
factory, "", System.nanoTime());
factory.rp.noSuchSegment(new WireCommands.NoSuchSegment(0, getQualifiedStreamSegmentName("", "", 0L), ""));
assertTrue(result.join());
result = helper.deleteTableSegment("", "", true, new MockHostControllerStore(),
factory, "", System.nanoTime());
factory.rp.segmentDeleted(new WireCommands.SegmentDeleted(0, getQualifiedStreamSegmentName("", "", 0L)));
assertTrue(result.join());
result = helper.deleteTableSegment("", "", true, new MockHostControllerStore(),
factory, "", System.nanoTime());
factory.rp.tableSegmentNotEmpty(new WireCommands.TableSegmentNotEmpty(0, getQualifiedStreamSegmentName("", "", 0L), ""));
AssertExtensions.assertThrows("", result::join,
ex -> ex instanceof WireCommandFailedException &&
(((WireCommandFailedException) ex).getReason() == WireCommandFailedException.Reason.TableSegmentNotEmpty));
Supplier<CompletableFuture<?>> futureSupplier = () -> helper.deleteTableSegment("", "", true, new MockHostControllerStore(), factory, "", System.nanoTime());
validateAuthTokenCheckFailed(factory, futureSupplier);
validateWrongHost(factory, futureSupplier);
validateConnectionDropped(factory, futureSupplier);
validateProcessingFailure(factory, futureSupplier);
}