@Test
  public void getStorableEntityLocationReturnsAbsolutePathToStorableEntity() {
    // Arrange:
    final File file =
        new File(Paths.get(TEST_FILE_DIRECTORY.toString(), "blah").toString(), "foo.bar");
    final TEntityFileDescriptor descriptor = this.createDescriptor(file);

    // Act:
    final String path = descriptor.getStorableEntityLocation();

    // Assert:
    Assert.assertThat(path, IsEqual.equalTo(file.getAbsolutePath()));
  }
  @Test
  public void openWriteCannotOpenFileThatIsInvalid() {
    // Arrange:
    final File file = Mockito.mock(File.class);
    Mockito.when(file.getName()).thenReturn("fo\0o.bar");
    Mockito.when(file.getAbsolutePath()).thenReturn("fo\0o.bar");
    final TEntityFileDescriptor descriptor = this.createDescriptor(file);

    // Act:
    ExceptionAssert.assertThrowsStorageException(
        v -> descriptor.openWrite(),
        this.getExceptionClass(),
        this.getExceptionValue(
            StorableEntityStorageException.Code.STORABLE_ENTITY_COULD_NOT_BE_SAVED.value()));
  }
  @Test
  public void deleteRaisesExceptionIfFileCannotBeDeleted() {
    // Arrange:
    final File file = Mockito.mock(File.class);
    Mockito.when(file.getName()).thenReturn("foo.bar");
    Mockito.when(file.getAbsolutePath()).thenReturn("foo.bar");
    final TEntityFileDescriptor descriptor = this.createDescriptor(file);

    Mockito.when(file.delete()).thenReturn(false);

    // Act:
    ExceptionAssert.assertThrowsStorageException(
        v -> descriptor.delete(),
        this.getExceptionClass(),
        this.getExceptionValue(
            StorableEntityStorageException.Code.STORABLE_ENTITY_COULD_NOT_BE_DELETED.value()));
  }