@Test
public void testAddTargets() throws Exception {

    final File testOutDir = new File(testOutBaseDir, "testAddTargets");
    FileUtils.deleteDirectory(testOutDir);
    testOutDir.mkdirs();
    WebsterMojo mojo = newMojo();
    mojo.baseDir = new File(testOutDir, "baseDir");
    mojo.websterTargets = obj()
            .key("nodetypes", obj())
            .key("privileges", obj())
            .get();
    final WebsterTarget fakeTarget = mock(WebsterTarget.class);
    final CompletableFuture<Boolean> performed = new CompletableFuture<>();
    doAnswer(call -> performed.complete(true)).when(fakeTarget).perform(any(Session.class));
    final WebsterPlan.Builder builder = new WebsterPlan.Builder();
    mojo.addTargets(builder, (basedir, config) -> Collections.singletonList(fakeTarget));
    final File segmentStore = new File(testOutDir, "segmentstore");
    builder.withFixtureProvider(() -> JcrFactory.getReadWriteFixture(segmentStore));
    builder.build().perform();
    assertTrue("should be performed", performed.getNow(false));
}