File tree Expand file tree Collapse file tree
java/org/kohsuke/stapler/html
resources/org/kohsuke/stapler/html Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .kohsuke .stapler .html ;
2+
3+ import org .kohsuke .stapler .test .JettyTestCase ;
4+
5+ public abstract class HtmlTestCase extends JettyTestCase {
6+
7+ protected final String load (String uri ) throws Exception {
8+ return createWebClient ()
9+ .getPage (url .toURI ().resolve (uri ).toURL ())
10+ .getWebResponse ()
11+ .getContentAsString ()
12+ .replaceAll ("<!--.+?-->" , " " )
13+ .replaceAll ("\\ s+" , " " )
14+ .trim ()
15+ .replace ('"' , '\'' );
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ package org .kohsuke .stapler .html ;
2+
3+ import static org .hamcrest .MatcherAssert .assertThat ;
4+ import static org .hamcrest .Matchers .is ;
5+
6+ public final class IncludedFromTest extends HtmlTestCase {
7+
8+ public void testIncludedFromJelly () throws Exception {
9+ assertThat (
10+ load ("top" ),
11+ is ("A prologue. <div> Center text includes a <span>special value</span>. </div> An epilogue." ));
12+ }
13+
14+ @ HtmlView ("center" )
15+ public Center getCenter () {
16+ return new Center ("special value" );
17+ }
18+
19+ public record Center (String value ) {}
20+ }
Original file line number Diff line number Diff line change 33import static org .hamcrest .MatcherAssert .assertThat ;
44import static org .hamcrest .Matchers .allOf ;
55import static org .hamcrest .Matchers .containsString ;
6- import static org .hamcrest .Matchers .is ;
76import static org .hamcrest .Matchers .not ;
87
98import edu .umd .cs .findbugs .annotations .CheckForNull ;
109import java .util .List ;
11- import org .kohsuke .stapler .test .JettyTestCase ;
1210
13- public final class SmokeTest extends JettyTestCase {
11+ public final class StructureTest extends HtmlTestCase {
1412
1513 Status status ;
1614
@@ -54,28 +52,4 @@ public record Items(List<Element> elements) {
5452 public record Element (String name , String value ) {}
5553 }
5654 }
57-
58- public void testCalledFromJelly () throws Exception {
59- assertThat (
60- load ("top" ),
61- is ("A prologue. <div> Center text includes a <span>special value</span>. </div> An epilogue." ));
62- }
63-
64- @ HtmlView ("center" )
65- public Center getCenter () {
66- return new Center ("special value" );
67- }
68-
69- public record Center (String value ) {}
70-
71- private String load (String uri ) throws Exception {
72- return createWebClient ()
73- .getPage (url .toURI ().resolve (uri ).toURL ())
74- .getWebResponse ()
75- .getContentAsString ()
76- .replaceAll ("<!--.+?-->" , " " )
77- .replaceAll ("\\ s+" , " " )
78- .trim ()
79- .replace ('"' , '\'' );
80- }
8155}
File renamed without changes.
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments