public void setInitialAttributes(File file, FileAttribute<?>... attrs) {
    // default values should already be sanitized by their providers
    for (int i = 0; i < defaultValues.size(); i++) {
      FileAttribute<?> attribute = defaultValues.get(i);

      int separatorIndex = attribute.name().indexOf(':');
      String view = attribute.name().substring(0, separatorIndex);
      String attr = attribute.name().substring(separatorIndex + 1);
      file.setAttribute(view, attr, attribute.value());
    }

    for (FileAttribute<?> attr : attrs) {
      setAttribute(file, attr.name(), attr.value(), true);
    }
  }
@Test
  public void testSetInitialAttributes() {
    File file = createFile();
    service.setInitialAttributes(file);

    assertThat(file.getAttributeNames("test")).containsExactly("bar", "baz");
    assertThat(file.getAttributeNames("owner")).containsExactly("owner");

    assertThat(service.getAttribute(file, "basic:lastModifiedTime")).isInstanceOf(FileTime.class);
    assertThat(file.getAttribute("test", "bar")).isEqualTo(0L);
    assertThat(file.getAttribute("test", "baz")).isEqualTo(1);
  }