ArchitectureViewCreator { public static Result createArchitectureView(DependencyGraph sourceGraph, Architecture architecture, String tag) { if (tag == null) { tag = architecture.getName(); } Result result = new Result(); List<String> unmappedClasses = new ArchitectureNodeCreator(sourceGraph, architecture).createAllArchitectureNodes(); if (!unmappedClasses.isEmpty()) { result.setViolationMessage(String.format("There are unmapped classes in architecture %s: %s", architecture.getName(), unmappedClasses)); } DependencyMapper.mapDependencies(sourceGraph, architecture.getName()); ArchitectureNodeTagger.tagArchitectureNodes(sourceGraph, architecture, tag); DependencyGraph architectureGraph = sourceGraph.getBaseGraph().filter( new AndFilter( new NodePropertyInFilter(tag, true), new NodePropertyInFilter("type", "architecture") )); BaseRelationTagger.tagBaseRelationNumbers(architectureGraph); result.setArchitectureGraph(architectureGraph); return result; } private  ArchitectureViewCreator(); static Result createArchitectureView(DependencyGraph sourceGraph, Architecture architecture, String tag);  }
@Test public void testCreateArchitectureView() { Result result = ArchitectureViewCreator.createArchitectureView(graph, architecture, null); assertThat(result.getViolationMessage(), nullValue()); assertResultingArchitecureGraph(result.getArchitectureGraph()); }
@Test public void testCreateArchitectureViewWithUnmappedClasses() { graph.getOrCreateNodeByName("com.my.other.nodes.A"); Result result = ArchitectureViewCreator.createArchitectureView(graph, architecture, architecture.getName()); assertThat(result.getViolationMessage(), is("There are unmapped classes in architecture Test-Architecture: [com.my.other.nodes.A]")); assertResultingArchitecureGraph(result.getArchitectureGraph()); }