@Override
  public Stream<HoodieBaseFile> getLatestBaseFilesBeforeOrOn(String partitionPath, String maxCommitTime) {
    return execute(partitionPath, maxCommitTime, preferredView::getLatestBaseFilesBeforeOrOn,
        (path, commitTime) -> getSecondaryView().getLatestBaseFilesBeforeOrOn(path, commitTime));
  }
@Test
  public void testGetLatestBaseFilesBeforeOrOn() {
    Stream<HoodieBaseFile> actual;
    Stream<HoodieBaseFile> expected = testBaseFileStream;
    String partitionPath = "/table2";
    String maxCommitTime = "2010-10-10";

    when(primary.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime))
        .thenReturn(testBaseFileStream);
    actual = fsView.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime);
    assertEquals(expected, actual);
    verify(secondaryViewSupplier, never()).get();

    resetMocks();
    when(secondaryViewSupplier.get()).thenReturn(secondary);
    when(primary.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime))
        .thenThrow(new RuntimeException());
    when(secondary.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime))
        .thenReturn(testBaseFileStream);
    actual = fsView.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime);
    assertEquals(expected, actual);

    resetMocks();
    when(secondary.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime))
        .thenReturn(testBaseFileStream);
    actual = fsView.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime);
    assertEquals(expected, actual);

    resetMocks();
    when(secondary.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime))
        .thenThrow(new RuntimeException());
    assertThrows(RuntimeException.class, () -> {
      fsView.getLatestBaseFilesBeforeOrOn(partitionPath, maxCommitTime);
    });
  }