### Question:
BackupManager { File findTableDir(@NotNull final File keyspaceDir, @NotNull final String table) { final File[] files = keyspaceDir.listFiles(); if (files != null) for (final File file : files) { if (file.isDirectory() && file.getName().startsWith(table + "-")) { return file; } } throw new IllegalStateException("Failed to found table dir for table " + table + " in keyspace " + keyspaceDir); } BackupManager(@NotNull final JmxConnect jmxConnect, @NotNull final String backupDir); void backup(@NotNull final String keyspace); void backup(@NotNull final String keyspace, @NotNull final String snapshot); void restore(@NotNull final String keyspace);  }### Answer:
@Test public void testFindTableDir() throws IOException { File keyspaceDir = new File(dataDir, KEYSPACE); File tableDir = new File(keyspaceDir, TABLE + "-123"); try { backupManager.findTableDir(keyspaceDir, TABLE); fail(); } catch (IllegalStateException e) {} Files.createDirectories(keyspaceDir.toPath()); try { backupManager.findTableDir(keyspaceDir, TABLE); fail(); } catch (IllegalStateException e) {} Files.createDirectories(tableDir.toPath()); File dir = backupManager.findTableDir(keyspaceDir, TABLE); assertEquals(tableDir, dir); }