Skip to content

Commit 1229834

Browse files
committed
fix tests
1 parent 17b1e9e commit 1229834

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

core/esmf-aspect-model-document-generators/src/test/java/org/eclipse/esmf/aspectmodel/generator/docu/AspectModelDocumentationGeneratorTest.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
import org.junit.jupiter.params.ParameterizedTest;
2929
import org.junit.jupiter.params.provider.EnumSource;
3030

31-
public class AspectModelDocumentationGeneratorTest {
31+
class AspectModelDocumentationGeneratorTest {
3232
@ParameterizedTest
3333
@EnumSource( value = TestAspect.class )
34-
public void testGeneration( final TestAspect testAspect ) {
34+
void testGeneration( final TestAspect testAspect ) {
3535
assertThatCode( () -> {
3636
final String html = generateHtmlDocumentation( testAspect );
3737
assertThat( html ).doesNotContain( "UnnamedCharacteristic" );
@@ -41,7 +41,7 @@ public void testGeneration( final TestAspect testAspect ) {
4141
}
4242

4343
@Test
44-
public void testAspectWithEntityCollection() throws Throwable {
44+
void testAspectWithEntityCollection() throws Throwable {
4545
final String htmlResult = generateHtmlDocumentation( TestAspect.ASPECT_WITH_ENTITY_COLLECTION );
4646

4747
assertThat( htmlResult ).isNotEmpty();
@@ -53,7 +53,7 @@ public void testAspectWithEntityCollection() throws Throwable {
5353
}
5454

5555
@Test
56-
public void testAspectWithCollectionOfSimpleType() throws Throwable {
56+
void testAspectWithCollectionOfSimpleType() throws Throwable {
5757
final String htmlResult = generateHtmlDocumentation( TestAspect.ASPECT_WITH_COLLECTION_OF_SIMPLE_TYPE );
5858

5959
assertThat( htmlResult ).isNotEmpty();
@@ -65,14 +65,15 @@ public void testAspectWithCollectionOfSimpleType() throws Throwable {
6565
}
6666

6767
@Test
68-
public void testScriptTagIsEscaped() throws IOException {
68+
void testScriptTagIsEscaped() throws IOException {
69+
System.out.println("TEST: " + generateHtmlDocumentation( TestAspect.ASPECT_WITH_SCRIPT_TAGS ));
6970
assertThat( generateHtmlDocumentation( TestAspect.ASPECT_WITH_SCRIPT_TAGS ) )
7071
.isNotEmpty()
71-
.doesNotContain( "<script>alert('Should not be alerted');</script>" );
72+
.doesNotContain( "Test preferred name with script: <script>alert('Should not be alerted');</script>" );
7273
}
7374

7475
@Test
75-
public void testRubyGemUpdateCommandIsNotExecuted() throws IOException {
76+
void testRubyGemUpdateCommandIsNotExecuted() throws IOException {
7677
try ( final ByteArrayOutputStream stdOut = new ByteArrayOutputStream() ) {
7778
System.setOut( new PrintStream( stdOut ) );
7879
generateHtmlDocumentation( TestAspect.ASPECT_WITH_RUBY_GEM_UPDATE_COMMAND );
@@ -81,7 +82,7 @@ public void testRubyGemUpdateCommandIsNotExecuted() throws IOException {
8182
}
8283

8384
@Test
84-
public void testHtmlTagsAreEscaped() throws IOException {
85+
void testHtmlTagsAreEscaped() throws IOException {
8586
assertThat( generateHtmlDocumentation( TestAspect.ASPECT_WITH_HTML_TAGS ) )
8687
.isNotEmpty()
8788
.doesNotContain( "<img src=xss.png onerror=alert('Boom!')>" )
@@ -90,20 +91,20 @@ public void testHtmlTagsAreEscaped() throws IOException {
9091
}
9192

9293
@Test
93-
public void testEncodedTextIsNotDecoded() throws IOException {
94+
void testEncodedTextIsNotDecoded() throws IOException {
9495
assertThat( generateHtmlDocumentation( TestAspect.ASPECT_WITH_ENCODED_STRINGS ) )
9596
.doesNotContain( "This is an Aspect with encoded text." )
9697
.contains( "VGhpcyBpcyBhbiBBc3BlY3Qgd2l0aCBlbmNvZGVkIHRleHQu" );
9798
}
9899

99100
@Test
100-
public void testAspectModelUrnIsDisplayed() throws IOException {
101+
void testAspectModelUrnIsDisplayed() throws IOException {
101102
assertThat( generateHtmlDocumentation( TestAspect.ASPECT_WITH_HTML_TAGS ) )
102103
.contains( "urn:samm:org.eclipse.esmf.test:1.0.0#AspectWithHtmlTags" );
103104
}
104105

105106
@Test
106-
public void testDocInfosAreDisplayed() throws IOException {
107+
void testDocInfosAreDisplayed() throws IOException {
107108
assertThat( generateHtmlDocumentation( TestAspect.ASPECT_WITH_HTML_TAGS ) )
108109
.contains( ".toc-list" )
109110
.contains( "aspect-model-diagram" )
@@ -115,13 +116,13 @@ public void testDocInfosAreDisplayed() throws IOException {
115116
}
116117

117118
@Test
118-
public void testDocumentationIsNotEmptyForModelWithoutLanguageTags() throws IOException {
119+
void testDocumentationIsNotEmptyForModelWithoutLanguageTags() throws IOException {
119120
final String aspectWithoutLanguageTags = generateHtmlDocumentation( TestAspect.ASPECT_WITHOUT_LANGUAGE_TAGS );
120121
assertThat( aspectWithoutLanguageTags ).isNotEmpty();
121122
}
122123

123124
@Test
124-
public void testAspectWithAbstractSingleEntityExpectSuccess() throws IOException {
125+
void testAspectWithAbstractSingleEntityExpectSuccess() throws IOException {
125126
final String documentation = generateHtmlDocumentation( TestAspect.ASPECT_WITH_ABSTRACT_SINGLE_ENTITY );
126127
assertThat( documentation ).contains(
127128
"<h3 id=\"org-eclipse-esmf-test-AspectWithAbstractSingleEntity-org-eclipse-esmf-test-testProperty-property\">testProperty</h3"
@@ -134,7 +135,7 @@ public void testAspectWithAbstractSingleEntityExpectSuccess() throws IOException
134135
}
135136

136137
@Test
137-
public void testAspectWithAbstractEntityExpectSuccess() throws IOException {
138+
void testAspectWithAbstractEntityExpectSuccess() throws IOException {
138139
final String documentation = generateHtmlDocumentation( TestAspect.ASPECT_WITH_ABSTRACT_ENTITY );
139140
assertThat( documentation ).contains(
140141
"<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 {
146147
}
147148

148149
@Test
149-
public void testAspectWithCollectionWithAbstractEntityExpectSuccess() throws IOException {
150+
void testAspectWithCollectionWithAbstractEntityExpectSuccess() throws IOException {
150151
final String documentation = generateHtmlDocumentation( TestAspect.ASPECT_WITH_COLLECTION_WITH_ABSTRACT_ENTITY );
151152
assertThat( documentation ).contains(
152153
"<h3 id=\"org-eclipse-esmf-test-AspectWithCollectionWithAbstractEntity-org-eclipse-esmf-test-testProperty-property"
@@ -159,7 +160,7 @@ public void testAspectWithCollectionWithAbstractEntityExpectSuccess() throws IOE
159160
}
160161

161162
@Test
162-
public void testAspectWithQuantifiableWithoutUnit() throws IOException {
163+
void testAspectWithQuantifiableWithoutUnit() throws IOException {
163164
try ( final ByteArrayOutputStream stdOut = new ByteArrayOutputStream() ) {
164165
System.setOut( new PrintStream( stdOut ) );
165166
assertThatCode( () -> generateHtmlDocumentation( TestAspect.ASPECT_WITH_QUANTIFIABLE_WITHOUT_UNIT ) )
@@ -168,7 +169,7 @@ public void testAspectWithQuantifiableWithoutUnit() throws IOException {
168169
}
169170

170171
@Test
171-
public void testAspectWithConstraintWithSeeAttribute() throws IOException {
172+
void testAspectWithConstraintWithSeeAttribute() throws IOException {
172173
final String documentation = generateHtmlDocumentation( TestAspect.ASPECT_WITH_CONSTRAINT_WITH_SEE_ATTRIBUTE );
173174
assertThat( documentation ).contains(
174175
"<h3 id=\"org-eclipse-esmf-test-AspectWithConstraintWithSeeAttribute-org-eclipse-esmf-test-testPropertyTwo-property"

0 commit comments

Comments
 (0)