Skip to content

Commit 054e58f

Browse files
Removes unused documentation section title property.
1 parent ae91d82 commit 054e58f

File tree

8 files changed

+28
-68
lines changed

8 files changed

+28
-68
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ subprojects { proj ->
88

99
description = 'Structurizr'
1010
group = 'com.structurizr'
11-
version = '1.22.0'
11+
version = '1.22.1'
1212

1313
repositories {
1414
mavenCentral()

docs/changelog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Changelog
22

3+
## 1.22.1 (5th March 2023)
4+
5+
- Removes unused documentation section title property.
6+
37
## 1.22.0 (5th March 2023)
48

5-
- Adds documentation to components.
9+
- Adds documentation to components.
610

711
## 1.21.0 (26th February 2023)
812

structurizr-core/src/com/structurizr/documentation/Decision.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
public final class Decision extends DocumentationContent {
1313

1414
private String id;
15+
private String title;
1516
private Date date;
1617
private String status;
1718

@@ -37,6 +38,19 @@ void setId(String id) {
3738
this.id = id;
3839
}
3940

41+
/**
42+
* Gets the title.
43+
*
44+
* @return the title, as a String
45+
*/
46+
public String getTitle() {
47+
return title;
48+
}
49+
50+
public void setTitle(String title) {
51+
this.title = title;
52+
}
53+
4054
/**
4155
* Gets the date of this decision.
4256
*

structurizr-core/src/com/structurizr/documentation/Documentation.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ public Documentation() {
2929
* @param section a Section object
3030
*/
3131
public void addSection(Section section) {
32-
checkTitleIsSpecified(section.getTitle());
3332
checkContentIsSpecified(section.getContent());
34-
checkSectionIsUnique(section.getTitle());
3533
checkFormatIsSpecified(section.getFormat());
3634

3735
section.setOrder(calculateOrder());
@@ -56,14 +54,6 @@ private void checkFormatIsSpecified(Format format) {
5654
}
5755
}
5856

59-
private void checkSectionIsUnique(String title) {
60-
for (Section section : sections) {
61-
if (title.equals(section.getTitle())) {
62-
throw new IllegalArgumentException("A section with a title of " + title + " already exists in this scope.");
63-
}
64-
}
65-
}
66-
6757
private int calculateOrder() {
6858
return sections.size() + 1;
6959
}

structurizr-core/src/com/structurizr/documentation/DocumentationContent.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public abstract class DocumentationContent {
88
// elementId is here for backwards compatibility
99
private String elementId;
1010

11-
private String title;
1211
private String content;
1312
private Format format;
1413

@@ -29,19 +28,6 @@ void setElementId(String elementId) {
2928
this.elementId = elementId;
3029
}
3130

32-
/**
33-
* Gets the title.
34-
*
35-
* @return the title, as a String
36-
*/
37-
public String getTitle() {
38-
return title;
39-
}
40-
41-
public void setTitle(String title) {
42-
this.title = title;
43-
}
44-
4531
/**
4632
* Gets the content.
4733
*

structurizr-core/src/com/structurizr/documentation/Section.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ public final class Section extends DocumentationContent {
1111
public Section() {
1212
}
1313

14-
public Section(String title, Format format, String content) {
15-
setTitle(title);
14+
public Section(Format format, String content) {
1615
setFormat(format);
1716
setContent(content);
1817
}
@@ -55,16 +54,16 @@ public boolean equals(Object object) {
5554

5655
Section section = (Section)object;
5756
if (getElementId() != null) {
58-
return getElementId().equals(section.getElementId()) && getTitle().equals(section.getTitle());
57+
return getElementId().equals(section.getElementId()) && getContent().equals(section.getContent());
5958
} else {
60-
return getTitle().equals(section.getTitle());
59+
return getContent().equals(section.getContent());
6160
}
6261
}
6362

6463
@Override
6564
public int hashCode() {
6665
int result = getElementId() != null ? getElementId().hashCode() : 0;
67-
result = 31 * result + getTitle().hashCode();
66+
result = 31 * result + getContent().hashCode();
6867
return result;
6968
}
7069

structurizr-core/test/unit/com/structurizr/documentation/DocumentationTests.java

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,10 @@ public void setUp() {
1515
documentation = workspace.getDocumentation();
1616
}
1717

18-
@Test
19-
void addSection_ThrowsAnException_WhenTheTitleIsNotSpecified() {
20-
try {
21-
Section section = new Section();
22-
23-
documentation.addSection(section);
24-
fail();
25-
} catch (IllegalArgumentException iae) {
26-
assertEquals("A title must be specified.", iae.getMessage());
27-
}
28-
}
29-
3018
@Test
3119
void addSection_ThrowsAnException_WhenTheContentIsNotSpecified() {
3220
try {
3321
Section section = new Section();
34-
section.setTitle("Title");
3522

3623
documentation.addSection(section);
3724
fail();
@@ -44,7 +31,6 @@ void addSection_ThrowsAnException_WhenTheContentIsNotSpecified() {
4431
void addSection_ThrowsAnException_WhenTheFormatIsNotSpecified() {
4532
try {
4633
Section section = new Section();
47-
section.setTitle("Title");
4834
section.setContent("Content");
4935

5036
documentation.addSection(section);
@@ -54,44 +40,26 @@ void addSection_ThrowsAnException_WhenTheFormatIsNotSpecified() {
5440
}
5541
}
5642

57-
@Test
58-
void addSection_ThrowsAnException_WhenASectionExistsWithTheSameTitle() {
59-
try {
60-
Section section = new Section();
61-
section.setTitle("Title");
62-
section.setContent("Content");
63-
section.setFormat(Format.Markdown);
64-
65-
documentation.addSection(section);
66-
documentation.addSection(section);
67-
fail();
68-
} catch (IllegalArgumentException iae) {
69-
assertEquals("A section with a title of Title already exists in this scope.", iae.getMessage());
70-
}
71-
}
72-
7343
@Test
7444
void addSection() {
7545
Section section = new Section();
76-
section.setTitle("Title");
7746
section.setContent("Content");
7847
section.setFormat(Format.Markdown);
7948

8049
documentation.addSection(section);
8150

8251
assertEquals(1, documentation.getSections().size());
8352
assertTrue(documentation.getSections().contains(section));
84-
assertEquals("Title", section.getTitle());
8553
assertEquals(Format.Markdown, section.getFormat());
8654
assertEquals("Content", section.getContent());
8755
assertEquals(1, section.getOrder());
8856
}
8957

9058
@Test
9159
void addSection_IncrementsTheSectionOrderNumber() {
92-
Section section1 = new Section("Title 1", Format.Markdown, "Content");
93-
Section section2 = new Section("Title 2", Format.Markdown, "Content");
94-
Section section3 = new Section("Title 3", Format.Markdown, "Content");
60+
Section section1 = new Section(Format.Markdown, "Content 1");
61+
Section section2 = new Section(Format.Markdown, "Content 2");
62+
Section section3 = new Section(Format.Markdown, "Content 3");
9563

9664
documentation.addSection(section1);
9765
documentation.addSection(section2);

structurizr-core/test/unit/com/structurizr/documentation/SectionTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ public class SectionTests {
88

99
@Test
1010
void construction() {
11-
Section section = new Section("Title", Format.Markdown, "Content");
11+
Section section = new Section(Format.Markdown, "Content");
1212

13-
assertEquals("Title", section.getTitle());
1413
assertEquals(Format.Markdown, section.getFormat());
1514
assertEquals("Content", section.getContent());
1615
}

0 commit comments

Comments
 (0)