コード例 #1
0
  @Test
  public void shouldReturnFalseWhenThereIsAStartEntryButNoCommitEntries() throws IOException {
    // given
    when(entryReader.readLogEntry(channel)).thenReturn(A_START_ENTRY, NULL_ENTRY);

    // when
    final boolean result = cursor.next();

    // then
    assertFalse(result);
    assertNull(cursor.get());
  }
コード例 #2
0
  @Test
  public void shouldCallTheVisitorWithTheFoundTransaction() throws IOException {
    // given
    when(entryReader.readLogEntry(channel))
        .thenReturn(A_START_ENTRY, A_COMMAND_ENTRY, A_COMMIT_ENTRY);

    // when
    cursor.next();

    // then
    PhysicalTransactionRepresentation txRepresentation =
        new PhysicalTransactionRepresentation(Arrays.asList(A_COMMAND_ENTRY.getXaCommand()));
    assertEquals(
        new CommittedTransactionRepresentation(A_START_ENTRY, txRepresentation, A_COMMIT_ENTRY),
        cursor.get());
  }