ArchitectureHeightTagger { public static void tagArchitectureHeight(DependencyGraph dependencyGraph, Architecture architecture) { String tagName = architecture.getName() + "-height"; tagComponentHeight(dependencyGraph, architecture, tagName); } private  ArchitectureHeightTagger(); static void tagArchitectureHeight(DependencyGraph dependencyGraph, Architecture architecture);  }
@Test public void testTagArchitectureHeight() { DependencyGraph dependencyGraph = DependencyGraphFactory.createGraph(); dependencyGraph.getOrCreateNodeByName("X.A.b"); dependencyGraph.getOrCreateNodeByName("X.A.c"); dependencyGraph.getOrCreateNodeByName("X.A.d"); dependencyGraph.getOrCreateNodeByName("com.company.project.E.f"); dependencyGraph.getOrCreateNodeByName("com.company.project.E.g"); Architecture packageArchitecture = new DefaultPackageArchitectureFactory(dependencyGraph).createArchitecture(); new ArchitectureNodeCreator(dependencyGraph, packageArchitecture).createAllArchitectureNodes(); ArchitectureHeightTagger.tagArchitectureHeight(dependencyGraph, packageArchitecture); String key = packageArchitecture.getName() + "-height"; assertThat(dependencyGraph.getNode("com.company.project.E"), notNullValue()); assertThat(dependencyGraph.getNode("com.company.project.E").getProperty(key), is(0)); assertThat(dependencyGraph.getNode("com.company.project.E.f").getProperty(key), nullValue()); assertThat(dependencyGraph.getNode("com.company.project.E.g").getProperty(key), nullValue()); assertThat(dependencyGraph.getNode("com.company.project.E").getProperty(key), is(0)); assertThat(dependencyGraph.getNode("com.company.project").getProperty(key), is(1)); assertThat(dependencyGraph.getNode("com.company").getProperty(key), is(2)); assertThat(dependencyGraph.getNode("com").getProperty(key), is(3)); }