@Override
  public Stream<HoodieBaseFile> getLatestBaseFiles(String partitionPath) {
    return execute(partitionPath, preferredView::getLatestBaseFiles, (path) -> getSecondaryView().getLatestBaseFiles(path));
  }
@Test
  public void testBadRequestExceptionWithPrimary() {
    final TestLogAppender appender = new TestLogAppender();
    final Logger logger = (Logger) LogManager.getLogger(PriorityBasedFileSystemView.class);
    try {
      appender.start();
      logger.addAppender(appender);
      Stream<HoodieBaseFile> actual;
      Stream<HoodieBaseFile> expected = testBaseFileStream;

      resetMocks();
      when(secondaryViewSupplier.get()).thenReturn(secondary);
      when(primary.getLatestBaseFiles()).thenThrow(new RuntimeException(new HttpResponseException(400, "Bad Request")));
      when(secondary.getLatestBaseFiles()).thenReturn(testBaseFileStream);
      actual = fsView.getLatestBaseFiles();
      assertEquals(expected, actual);
      final List<LogEvent> logs = appender.getLog();
      final LogEvent firstLogEntry = logs.get(0);
      assertEquals(firstLogEntry.getLevel(), Level.WARN);
      assertTrue((firstLogEntry.getMessage().getFormattedMessage()).contains("Got error running preferred function. Likely due to another "
          + "concurrent writer in progress. Trying secondary"));
    } finally {
      logger.removeAppender(appender);
    }
  }