Skip to content

Commit

Permalink
Adds assertions re: URLs.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Sep 18, 2024
1 parent ce11bf3 commit 71de823
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.structurizr.component.filter.IncludeFullyQualifiedNameRegexFilter;
import com.structurizr.component.matcher.ImplementsTypeMatcher;
import com.structurizr.component.naming.TypeNamingStrategy;
import com.structurizr.component.url.PrefixSourceUrlStrategy;
import com.structurizr.model.Component;
import com.structurizr.model.Container;
import com.structurizr.model.SoftwareSystem;
Expand Down Expand Up @@ -35,6 +36,7 @@ void run() {
.filteredBy(new IncludeFullyQualifiedNameRegexFilter("com\\.structurizr\\.component\\.example\\..*"))
.withName(new TypeNamingStrategy())
.withDescription(new FirstSentenceDescriptionStrategy())
.withUrl(new PrefixSourceUrlStrategy("https://example.com/src/main/java"))
.build()
)
.withStrategy(new ComponentFinderStrategyBuilder()
Expand All @@ -43,6 +45,7 @@ void run() {
.filteredBy(new IncludeFullyQualifiedNameRegexFilter("com\\.structurizr\\.component\\.example\\..*"))
.withName(new TypeNamingStrategy())
.withDescription(new FirstSentenceDescriptionStrategy())
.withUrl(new PrefixSourceUrlStrategy("https://example.com/src/main/java"))
.build()
)
.build();
Expand All @@ -52,11 +55,13 @@ void run() {
assertEquals(2, container.getComponents().size());
Component exampleController = container.getComponentWithName("ExampleController");
assertNotNull(exampleController);
assertEquals("https://example.com/src/main/java/com/structurizr/component/example/ExampleController.java", exampleController.getUrl());
assertTrue(exampleController.hasTag("Controller"));
assertEquals("https://example.com", exampleController.getProperties().get("Documentation"));

Component exampleRepository = container.getComponentWithName("ExampleRepository");
assertNotNull(exampleRepository);
assertEquals("https://example.com/src/main/java/com/structurizr/component/example/ExampleRepository.java", exampleRepository.getUrl());

assertTrue(exampleController.hasEfferentRelationshipWith(exampleRepository));
}
Expand Down

0 comments on commit 71de823

Please sign in to comment.