@Test
public void testCreateArchitecture() {

    DependencyGraph dependencyGraph = DependencyGraphFactory.createGraph();
    dependencyGraph.getOrCreateNodeByName("com.example.api.A");
    dependencyGraph.getOrCreateNodeByName("com.example.api.B");
    dependencyGraph.getOrCreateNodeByName("com.example.api.C");
    DefaultPackageArchitectureFactory factory = new DefaultPackageArchitectureFactory(dependencyGraph);
    factory.setArchitectureName("my-architecture");
    Architecture architecture = factory.createArchitecture();
    assertThat(architecture.getName(), is("my-architecture"));
    assertThat(architecture.getAllComponents(), hasSize(3));
    assertThat(getComponentNameList(architecture),
            is(Lists.newArrayList("com.example.api", "com.example", "com")));
    assertThat(architecture.getParentComponentName("com.example.api.A"), is("com.example.api"));
    Component component = architecture.getApiNameToComponent().get("com.example.api");
    assertThat(component.getName(), is("com.example.api"));
    ClassSet apiDef = component.getApi().get("com.example.api");
    assertThat(apiDef.getPatterns(), hasSize(1));
    assertThat(apiDef.getPatterns().get(0), is("com.example.api.**"));
}