@Test
  public void shouldSaveNewLibrary() {
    setupData("shared");

    ResourcePersister persister =
        new DefaultResourcePersister(getSession(), mock(ResourcePermissions.class));
    persister.saveProject(singleProject, null);
    persister.saveResource(
        singleProject, new Library("junit:junit", "4.8.2").setEffectiveKey("junit:junit"));
    persister.saveResource(
        singleProject,
        new Library("junit:junit", "4.8.2")
            .setEffectiveKey("junit:junit")); // do nothing, already saved
    persister.saveResource(
        singleProject, new Library("junit:junit", "3.2").setEffectiveKey("junit:junit"));

    checkTables(
        "shouldSaveNewLibrary", new String[] {"build_date", "created_at"}, "projects", "snapshots");
  }
  @Test
  public void shouldSaveNewDirectory() {
    setupData("shared");

    ResourcePersister persister =
        new DefaultResourcePersister(getSession(), mock(ResourcePermissions.class));
    persister.saveProject(singleProject, null);
    persister.saveResource(
        singleProject, new JavaPackage("org.foo").setEffectiveKey("foo:org.foo"));

    // check that the directory is attached to the project
    checkTables(
        "shouldSaveNewDirectory",
        new String[] {"build_date", "created_at"},
        "projects",
        "snapshots");
  }