28
28
import org .junit .jupiter .params .ParameterizedTest ;
29
29
import org .junit .jupiter .params .provider .EnumSource ;
30
30
31
- public class AspectModelDocumentationGeneratorTest {
31
+ class AspectModelDocumentationGeneratorTest {
32
32
@ ParameterizedTest
33
33
@ EnumSource ( value = TestAspect .class )
34
- public void testGeneration ( final TestAspect testAspect ) {
34
+ void testGeneration ( final TestAspect testAspect ) {
35
35
assertThatCode ( () -> {
36
36
final String html = generateHtmlDocumentation ( testAspect );
37
37
assertThat ( html ).doesNotContain ( "UnnamedCharacteristic" );
@@ -41,7 +41,7 @@ public void testGeneration( final TestAspect testAspect ) {
41
41
}
42
42
43
43
@ Test
44
- public void testAspectWithEntityCollection () throws Throwable {
44
+ void testAspectWithEntityCollection () throws Throwable {
45
45
final String htmlResult = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_ENTITY_COLLECTION );
46
46
47
47
assertThat ( htmlResult ).isNotEmpty ();
@@ -53,7 +53,7 @@ public void testAspectWithEntityCollection() throws Throwable {
53
53
}
54
54
55
55
@ Test
56
- public void testAspectWithCollectionOfSimpleType () throws Throwable {
56
+ void testAspectWithCollectionOfSimpleType () throws Throwable {
57
57
final String htmlResult = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_COLLECTION_OF_SIMPLE_TYPE );
58
58
59
59
assertThat ( htmlResult ).isNotEmpty ();
@@ -65,14 +65,15 @@ public void testAspectWithCollectionOfSimpleType() throws Throwable {
65
65
}
66
66
67
67
@ Test
68
- public void testScriptTagIsEscaped () throws IOException {
68
+ void testScriptTagIsEscaped () throws IOException {
69
+ System .out .println ("TEST: " + generateHtmlDocumentation ( TestAspect .ASPECT_WITH_SCRIPT_TAGS ));
69
70
assertThat ( generateHtmlDocumentation ( TestAspect .ASPECT_WITH_SCRIPT_TAGS ) )
70
71
.isNotEmpty ()
71
- .doesNotContain ( "<script>alert('Should not be alerted');</script>" );
72
+ .doesNotContain ( "Test preferred name with script: <script>alert('Should not be alerted');</script>" );
72
73
}
73
74
74
75
@ Test
75
- public void testRubyGemUpdateCommandIsNotExecuted () throws IOException {
76
+ void testRubyGemUpdateCommandIsNotExecuted () throws IOException {
76
77
try ( final ByteArrayOutputStream stdOut = new ByteArrayOutputStream () ) {
77
78
System .setOut ( new PrintStream ( stdOut ) );
78
79
generateHtmlDocumentation ( TestAspect .ASPECT_WITH_RUBY_GEM_UPDATE_COMMAND );
@@ -81,7 +82,7 @@ public void testRubyGemUpdateCommandIsNotExecuted() throws IOException {
81
82
}
82
83
83
84
@ Test
84
- public void testHtmlTagsAreEscaped () throws IOException {
85
+ void testHtmlTagsAreEscaped () throws IOException {
85
86
assertThat ( generateHtmlDocumentation ( TestAspect .ASPECT_WITH_HTML_TAGS ) )
86
87
.isNotEmpty ()
87
88
.doesNotContain ( "<img src=xss.png onerror=alert('Boom!')>" )
@@ -90,20 +91,20 @@ public void testHtmlTagsAreEscaped() throws IOException {
90
91
}
91
92
92
93
@ Test
93
- public void testEncodedTextIsNotDecoded () throws IOException {
94
+ void testEncodedTextIsNotDecoded () throws IOException {
94
95
assertThat ( generateHtmlDocumentation ( TestAspect .ASPECT_WITH_ENCODED_STRINGS ) )
95
96
.doesNotContain ( "This is an Aspect with encoded text." )
96
97
.contains ( "VGhpcyBpcyBhbiBBc3BlY3Qgd2l0aCBlbmNvZGVkIHRleHQu" );
97
98
}
98
99
99
100
@ Test
100
- public void testAspectModelUrnIsDisplayed () throws IOException {
101
+ void testAspectModelUrnIsDisplayed () throws IOException {
101
102
assertThat ( generateHtmlDocumentation ( TestAspect .ASPECT_WITH_HTML_TAGS ) )
102
103
.contains ( "urn:samm:org.eclipse.esmf.test:1.0.0#AspectWithHtmlTags" );
103
104
}
104
105
105
106
@ Test
106
- public void testDocInfosAreDisplayed () throws IOException {
107
+ void testDocInfosAreDisplayed () throws IOException {
107
108
assertThat ( generateHtmlDocumentation ( TestAspect .ASPECT_WITH_HTML_TAGS ) )
108
109
.contains ( ".toc-list" )
109
110
.contains ( "aspect-model-diagram" )
@@ -115,13 +116,13 @@ public void testDocInfosAreDisplayed() throws IOException {
115
116
}
116
117
117
118
@ Test
118
- public void testDocumentationIsNotEmptyForModelWithoutLanguageTags () throws IOException {
119
+ void testDocumentationIsNotEmptyForModelWithoutLanguageTags () throws IOException {
119
120
final String aspectWithoutLanguageTags = generateHtmlDocumentation ( TestAspect .ASPECT_WITHOUT_LANGUAGE_TAGS );
120
121
assertThat ( aspectWithoutLanguageTags ).isNotEmpty ();
121
122
}
122
123
123
124
@ Test
124
- public void testAspectWithAbstractSingleEntityExpectSuccess () throws IOException {
125
+ void testAspectWithAbstractSingleEntityExpectSuccess () throws IOException {
125
126
final String documentation = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_ABSTRACT_SINGLE_ENTITY );
126
127
assertThat ( documentation ).contains (
127
128
"<h3 id=\" org-eclipse-esmf-test-AspectWithAbstractSingleEntity-org-eclipse-esmf-test-testProperty-property\" >testProperty</h3"
@@ -134,7 +135,7 @@ public void testAspectWithAbstractSingleEntityExpectSuccess() throws IOException
134
135
}
135
136
136
137
@ Test
137
- public void testAspectWithAbstractEntityExpectSuccess () throws IOException {
138
+ void testAspectWithAbstractEntityExpectSuccess () throws IOException {
138
139
final String documentation = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_ABSTRACT_ENTITY );
139
140
assertThat ( documentation ).contains (
140
141
"<h3 id=\" org-eclipse-esmf-test-AspectWithAbstractEntity-org-eclipse-esmf-test-testProperty-property\" >Test Property</h3>" );
@@ -146,7 +147,7 @@ public void testAspectWithAbstractEntityExpectSuccess() throws IOException {
146
147
}
147
148
148
149
@ Test
149
- public void testAspectWithCollectionWithAbstractEntityExpectSuccess () throws IOException {
150
+ void testAspectWithCollectionWithAbstractEntityExpectSuccess () throws IOException {
150
151
final String documentation = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_COLLECTION_WITH_ABSTRACT_ENTITY );
151
152
assertThat ( documentation ).contains (
152
153
"<h3 id=\" org-eclipse-esmf-test-AspectWithCollectionWithAbstractEntity-org-eclipse-esmf-test-testProperty-property"
@@ -159,7 +160,7 @@ public void testAspectWithCollectionWithAbstractEntityExpectSuccess() throws IOE
159
160
}
160
161
161
162
@ Test
162
- public void testAspectWithQuantifiableWithoutUnit () throws IOException {
163
+ void testAspectWithQuantifiableWithoutUnit () throws IOException {
163
164
try ( final ByteArrayOutputStream stdOut = new ByteArrayOutputStream () ) {
164
165
System .setOut ( new PrintStream ( stdOut ) );
165
166
assertThatCode ( () -> generateHtmlDocumentation ( TestAspect .ASPECT_WITH_QUANTIFIABLE_WITHOUT_UNIT ) )
@@ -168,7 +169,7 @@ public void testAspectWithQuantifiableWithoutUnit() throws IOException {
168
169
}
169
170
170
171
@ Test
171
- public void testAspectWithConstraintWithSeeAttribute () throws IOException {
172
+ void testAspectWithConstraintWithSeeAttribute () throws IOException {
172
173
final String documentation = generateHtmlDocumentation ( TestAspect .ASPECT_WITH_CONSTRAINT_WITH_SEE_ATTRIBUTE );
173
174
assertThat ( documentation ).contains (
174
175
"<h3 id=\" org-eclipse-esmf-test-AspectWithConstraintWithSeeAttribute-org-eclipse-esmf-test-testPropertyTwo-property"
0 commit comments