public void write(final TransientQueryMetadata queryMetadata) {
    try {
      currentLocalCommands.write(
          new TransientQueryLocalCommand(queryMetadata.getQueryApplicationId()));
    } catch (IOException e) {
      // Just log an error since not catching it would likely cause more cleanup work than this
      // aims to fix.
      LOG.error("Failed to write local command for transient query:"
          + queryMetadata.getQueryApplicationId(), e);
    }
  }
@Test
  public void shouldFailToWrite_error() throws IOException {
    // Given
    final File dir = commandsDir.newFolder();
    LocalCommands localCommands = new LocalCommands(dir, ksqlEngine, localCommandsFile);
    doThrow(new IOException("Error")).when(localCommandsFile).write(any());

    // When
    localCommands.write(metadata1);
  }