@Test
 public void testUnexpectedSavepointBackend() throws Exception {
   Configuration config = new Configuration();
   config.setString(SavepointStoreFactory.SAVEPOINT_BACKEND_KEY, "unexpected");
   SavepointStore store = SavepointStoreFactory.createFromConfig(config);
   assertTrue(store.getStateStore() instanceof HeapStateStore);
 }
 @Test
 public void testSavepointBackendFileSystemButNoDirectory() throws Exception {
   Configuration config = new Configuration();
   config.setString(SavepointStoreFactory.SAVEPOINT_BACKEND_KEY, "filesystem");
   SavepointStore store = SavepointStoreFactory.createFromConfig(config);
   assertTrue(store.getStateStore() instanceof HeapStateStore);
 }
  @Test
  public void testSavepointBackendFileSystemButCheckpointBackendJobManager() throws Exception {
    Configuration config = new Configuration();

    // This combination does not make sense, because the checkpoints will be
    // lost after the job manager shuts down.
    config.setString(ConfigConstants.STATE_BACKEND, "jobmanager");
    config.setString(SavepointStoreFactory.SAVEPOINT_BACKEND_KEY, "filesystem");
    SavepointStore store = SavepointStoreFactory.createFromConfig(config);
    assertTrue(store.getStateStore() instanceof HeapStateStore);
  }
  @Test
  public void testSavepointBackendFileSystem() throws Exception {
    Configuration config = new Configuration();
    String rootPath = System.getProperty("java.io.tmpdir");
    config.setString(ConfigConstants.STATE_BACKEND, "filesystem");
    config.setString(SavepointStoreFactory.SAVEPOINT_BACKEND_KEY, "filesystem");
    config.setString(SavepointStoreFactory.SAVEPOINT_DIRECTORY_KEY, rootPath);

    SavepointStore store = SavepointStoreFactory.createFromConfig(config);
    assertTrue(store.getStateStore() instanceof FileSystemStateStore);

    FileSystemStateStore<CompletedCheckpoint> stateStore =
        (FileSystemStateStore<CompletedCheckpoint>) store.getStateStore();
    assertEquals(new Path(rootPath), stateStore.getRootPath());
  }
 @Test
 public void testStateStoreWithDefaultConfig() throws Exception {
   SavepointStore store = SavepointStoreFactory.createFromConfig(new Configuration());
   assertTrue(store.getStateStore() instanceof HeapStateStore);
 }