@Test
void testSubSequence() {

    final RingBuffer buffer = RingBuffer.fromString("0123456789");
    assertThat(buffer.subSequence(5, 3).toString()).isEqualTo("567");
    assertThat(buffer.subSequence(8, 2).toString()).isEqualTo("89");
    buffer.append("01234");
    assertThat(buffer.toString()).isEqualTo("5678901234");
    assertThat(buffer.subSequence(5, 3).toString()).isEqualTo("012");
    assertThat(buffer.subSequence(8, 2).toString()).isEqualTo("34");
    assertThat(buffer.subSequence(8, 5).toString()).isEqualTo("34567");
    assertThatThrownBy(() -> buffer.subSequence(10, 2)).isInstanceOf(IndexOutOfBoundsException.class);
    assertThatThrownBy(() -> buffer.subSequence(-1, 2)).isInstanceOf(IndexOutOfBoundsException.class);
    assertThatThrownBy(() -> buffer.subSequence(8, 11)).isInstanceOf(IndexOutOfBoundsException.class);
    assertThatThrownBy(() -> buffer.subSequence(8, -1)).isInstanceOf(IndexOutOfBoundsException.class);
}