use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parseTags_AddsTheTags_WhenTagsAreSpecified.
@Test
void test_parseTags_AddsTheTags_WhenTagsAreSpecified() {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
parser.parseTags(context, tokens("tags", "Tag 1"));
assertEquals(3, softwareSystem.getTagsAsSet().size());
assertTrue(softwareSystem.getTagsAsSet().contains("Tag 1"));
parser.parseTags(context, tokens("tags", "Tag 1, Tag 2, Tag 3"));
assertEquals(5, softwareSystem.getTagsAsSet().size());
assertTrue(softwareSystem.getTagsAsSet().contains("Tag 2"));
assertTrue(softwareSystem.getTagsAsSet().contains("Tag 3"));
parser.parseTags(context, tokens("tags", "Tag 3", "Tag 4", "Tag 5"));
assertEquals(7, softwareSystem.getTagsAsSet().size());
assertTrue(softwareSystem.getTagsAsSet().contains("Tag 4"));
assertTrue(softwareSystem.getTagsAsSet().contains("Tag 5"));
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parseDescription_SetsTheDescription_WhenADescriptionIsSpecified.
@Test
void test_parseDescription_SetsTheDescription_WhenADescriptionIsSpecified() {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "");
ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
parser.parseDescription(context, tokens("description", "Description"));
assertEquals("Description", softwareSystem.getDescription());
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parseTags_ThrowsAnException_WhenNoTagsAreSpecified.
@Test
void test_parseTags_ThrowsAnException_WhenNoTagsAreSpecified() {
try {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
parser.parseTags(context, tokens("tags"));
fail();
} catch (Exception e) {
assertEquals("Expected: tags <tags> [tags]", e.getMessage());
}
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class ModelItemParserTests method test_parseUrl_ThrowsAnException_WhenNoUrlIsSpecified.
@Test
void test_parseUrl_ThrowsAnException_WhenNoUrlIsSpecified() {
try {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
ModelItemDslContext context = new SoftwareSystemDslContext(softwareSystem);
parser.parseUrl(context, tokens("url"));
fail();
} catch (Exception e) {
assertEquals("Expected: url <url>", e.getMessage());
}
}
use of com.structurizr.model.SoftwareSystem in project dsl by structurizr.
the class PropertyParserTests method test_parseProperty_ThrowsAnException_WhenNoValueIsSpecified.
@Test
void test_parseProperty_ThrowsAnException_WhenNoValueIsSpecified() {
try {
SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
PropertiesDslContext context = new PropertiesDslContext(softwareSystem);
new PropertyParser().parse(context, tokens("name"));
fail();
} catch (Exception e) {
assertEquals("Expected: <name> <value>", e.getMessage());
}
}
Aggregations