@Test
public void testImportFdsFromJson() throws Exception {

    DefaultMetadataStore metadataStore = new DefaultMetadataStore();
    Schema schema = metadataStore.addSchema("WDC", "", new DefaultLocation());
    Table table = schema.addTable(metadataStore, "WDC_astronomical.csv", "", new DefaultLocation());
    Column name = table.addColumn(metadataStore, "Name", "", 0);
    Column iau = table.addColumn(metadataStore, "IAU abbreviation", "", 1);
    Column symbol = table.addColumn(metadataStore, "Symbol", "", 2);
    Column unicodeCodepoint = table.addColumn(metadataStore, "Unicode codepoint", "", 3);
    Column unicodeDisplay = table.addColumn(metadataStore, "Unicode display", "", 4);
    Column represents = table.addColumn(metadataStore, "Represents", "", 5);
    File inputFile = new File(Thread.currentThread().getContextClassLoader().getResource("metanome-fds.json").toURI());
    MetanomeDependencyImportApp.fromParameters(
            metadataStore,
            inputFile.getAbsolutePath(),
            ".+",
            "json",
            "FD",
            "WDC",
            "WDC",
            null
    );
    Collection<ConstraintCollection<FunctionalDependency>> constraintCollections =
            metadataStore.getConstraintCollectionByConstraintTypeAndScope(
                    FunctionalDependency.class, metadataStore.getTargetByName("WDC.WDC_astronomical.csv")
            );
    Assert.assertEquals(1, constraintCollections.size());
    ConstraintCollection<FunctionalDependency> constraintCollection = constraintCollections.iterator().next();
    Assert.assertEquals(4, constraintCollection.getConstraints().size());
    Set<FunctionalDependency> discoveredFds = new HashSet<>(constraintCollection.getConstraints());
    Set<FunctionalDependency> expectedFds = new HashSet<>();
    expectedFds.add(new FunctionalDependency(new int[0], symbol.getId()));
    expectedFds.add(new FunctionalDependency(new int[]{iau.getId()}, name.getId()));
    expectedFds.add(new FunctionalDependency(new int[]{name.getId()}, iau.getId()));
    expectedFds.add(new FunctionalDependency(new int[]{unicodeCodepoint.getId(), represents.getId()}, iau.getId()));
    Assert.assertEquals(expectedFds, discoveredFds);
}