This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 0e7b757 Tests.
0e7b757 is described below
commit 0e7b75782524a34ad0d6f1effbaa9496b0e6f88e
Author: JamesBognar <[email protected]>
AuthorDate: Mon May 14 20:02:13 2018 -0400
Tests.
---
.../org/apache/juneau/utils/StringUtilsTest.java | 10 +
.../org/apache/juneau/internal/StringUtils.java | 22 ++
.../juneau/rest/test/HtmlDocLinksResource.java | 255 ----------------
.../apache/juneau/rest/test/HtmlDocResource.java | 188 ------------
.../java/org/apache/juneau/rest/test/Root.java | 2 -
.../apache/juneau/rest/test/HtmlDocLinksTest.java | 337 ---------------------
.../org/apache/juneau/rest/test/HtmlDocTest.java | 291 ------------------
.../org/apache/juneau/rest/test/_TestSuite.java | 2 -
.../org/apache/juneau/rest/RestContextBuilder.java | 4 +-
.../org/apache/juneau/rest/StaticFileMapping.java | 4 +-
.../juneau/rest/mock/MockServletResponse.java | 56 +++-
.../juneau/rest/annotation/HtmlDocAsideTest.java | 126 ++++++++
.../juneau/rest/annotation/HtmlDocFooterTest.java | 126 ++++++++
.../juneau/rest/annotation/HtmlDocHeaderTest.java | 126 ++++++++
.../juneau/rest/annotation/HtmlDocNavTest.java | 126 ++++++++
.../rest/annotation/HtmlDocNavlinksTest.java | 224 ++++++++++++++
.../juneau/rest/annotation/HtmlDocScriptTest.java | 126 ++++++++
.../juneau/rest/annotation/HtmlDocStyleTest.java | 126 ++++++++
18 files changed, 1067 insertions(+), 1084 deletions(-)
diff --git
a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java
index 9f33dbd..d2da6af 100755
---
a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java
+++
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/utils/StringUtilsTest.java
@@ -888,4 +888,14 @@ public class StringUtilsTest {
assertTrue(compare("b",null) > 0);
assertTrue(compare(null,null) == 0);
}
+
+
//====================================================================================================
+ // matchPattern(String)
+
//====================================================================================================
+ @Test
+ public void testGetMatchPattern() throws Exception {
+ assertTrue(getMatchPattern("a").matcher("a").matches());
+ assertTrue(getMatchPattern("*a*").matcher("aaa").matches());
+ assertFalse(getMatchPattern("*b*").matcher("aaa").matches());
+ }
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
index d3c50d1..f1d7c09 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/internal/StringUtils.java
@@ -2286,4 +2286,26 @@ public final class StringUtils {
return 0;
return s.charAt(0);
}
+
+ /**
+ * Converts a string containing <js>"*"</js> meta characters with a
regular expression pattern.
+ *
+ * @param s The string to create a pattern from.
+ * @return A regular expression pattern.
+ */
+ public static Pattern getMatchPattern(String s) {
+ if (s == null)
+ return null;
+ StringBuilder sb = new StringBuilder();
+ sb.append("\\Q");
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if (c == '*')
+ sb.append("\\E").append(".*").append("\\Q");
+ else
+ sb.append(c);
+ }
+ sb.append("\\E");
+ return Pattern.compile(sb.toString());
+ }
}
diff --git
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocLinksResource.java
b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocLinksResource.java
deleted file mode 100644
index 9c1ceeb..0000000
---
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocLinksResource.java
+++ /dev/null
@@ -1,255 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.test;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * Validates inheritance on the @HtmlDoc.navlinks() annotation.
- */
-@RestResource(
- path="/testHtmlDocLinks",
- htmldoc=@HtmlDoc(
- navlinks={"links1a","links1b"}
- ),
- children={
- HtmlDocLinksResource.HtmlDocLinksResource2.class
- }
-)
-public class HtmlDocLinksResource extends BasicRestServlet {
- private static final long serialVersionUID = 1L;
-
- @RestMethod(path="/test1")
- public Object test1() {
- return "OK";
- }
-
- @RestMethod(
- path="/test2",
- htmldoc=@HtmlDoc(
- navlinks={"links2a","links2b"}
- )
- )
- public Object test2() {
- return "OK";
- }
-
- @RestMethod(
- path="/test3",
- htmldoc=@HtmlDoc(
- navlinks={"INHERIT","links3a","links3b"}
- )
- )
- public Object test3() {
- return "OK";
- }
-
- @RestMethod(
- path="/test4",
- htmldoc=@HtmlDoc(
- navlinks={"links4a","INHERIT","links4b"}
- )
- )
- public Object test4() {
- return "OK";
- }
-
- @RestMethod(
- path="/test5",
- htmldoc=@HtmlDoc(
- navlinks={"links5a","links5b","INHERIT"}
- )
- )
- public Object test5() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6a",
- htmldoc=@HtmlDoc(
- navlinks={"INHERIT","[0]:links6a","[3]:links6b"}
- )
- )
- public Object test6a() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6b",
- htmldoc=@HtmlDoc(
- navlinks={"[1]:links6a","[2]:links6b","INHERIT"}
- )
- )
- public Object test6b() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6c",
- htmldoc=@HtmlDoc(
- navlinks={"[1]:links6a","[0]:links6b"}
- )
- )
- public Object test6c() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6d",
- htmldoc=@HtmlDoc(
- navlinks={"INHERIT","foo[0]:links6a","bar[3]:links6b"}
- )
- )
- public Object test6d() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6e",
- htmldoc=@HtmlDoc(
- navlinks={"foo[1]:links6a","bar[2]:links6b","INHERIT"}
- )
- )
- public Object test6e() {
- return "OK";
- }
-
- @RestMethod(
- path="/test6f",
- htmldoc=@HtmlDoc(
- navlinks={"foo[1]:links6a","bar[0]:links6b"}
- )
- )
- public Object test6f() {
- return "OK";
- }
-
- @RestResource(
- path="/testHtmlDocLinks2",
- htmldoc=@HtmlDoc(
- navlinks={"INHERIT","links11a","links11b"}
- )
- )
- public static class HtmlDocLinksResource2 extends HtmlDocLinksResource {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @RestMethod(path="/test11")
- public Object test11() {
- return "OK";
- }
-
- @RestMethod(
- path="/test12",
- htmldoc=@HtmlDoc(
- navlinks={"links12a","links12b"}
- )
- )
- public Object test12() {
- return "OK";
- }
-
- @RestMethod(
- path="/test13",
- htmldoc=@HtmlDoc(
- navlinks={"INHERIT","links13a","links13b"}
- )
- )
- public Object test13() {
- return "OK";
- }
-
- @RestMethod(
- path="/test14",
- htmldoc=@HtmlDoc(
- navlinks={"links14a","INHERIT","links14b"}
- )
- )
- public Object test14() {
- return "OK";
- }
-
- @RestMethod(
- path="/test15",
- htmldoc=@HtmlDoc(
- navlinks={"links15a","links15b","INHERIT"}
- )
- )
- public Object test15() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16a",
- htmldoc=@HtmlDoc(
-
navlinks={"INHERIT","[0]:links16a","[3]:links16b"}
- )
- )
- public Object test16a() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16b",
- htmldoc=@HtmlDoc(
-
navlinks={"[1]:links16a","[2]:links16b","INHERIT"}
- )
- )
- public Object test16b() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16c",
- htmldoc=@HtmlDoc(
- navlinks={"[1]:links16a","[0]:links16b"}
- )
- )
- public Object test16c() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16d",
- htmldoc=@HtmlDoc(
-
navlinks={"INHERIT","foo[0]:links16a","bar[3]:links16b"}
- )
- )
- public Object test16d() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16e",
- htmldoc=@HtmlDoc(
-
navlinks={"foo[1]:links16a","bar[2]:links16b","INHERIT"}
- )
- )
- public Object test16e() {
- return "OK";
- }
-
- @RestMethod(
- path="/test16f",
- htmldoc=@HtmlDoc(
- navlinks={"foo[1]:links16a","bar[0]:links16b"}
- )
- )
- public Object test16f() {
- return "OK";
- }
- }
-}
diff --git
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocResource.java
b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocResource.java
deleted file mode 100644
index 7cc9eeb..0000000
---
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/HtmlDocResource.java
+++ /dev/null
@@ -1,188 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.test;
-
-import org.apache.juneau.rest.*;
-import org.apache.juneau.rest.annotation.*;
-
-/**
- * Validates inheritance on the @HtmlDoc annotation.
- */
-@RestResource(
- path="/testHtmlDoc",
- htmldoc=@HtmlDoc(
- aside={"aside1a","aside1b","INHERIT"},
- footer={"footer1a","footer1b"},
- header={"header1a","header1b"},
- navlinks={"NONE"},
- nav={"nav1a","nav1b"},
- script={"script1a","script1b"},
- style={"style1a","style1b"},
- stylesheet="stylesheet1",
- nowrap="false"
- ),
- children={
- HtmlDocResource.HtmlDocResource2.class
- }
-)
-public class HtmlDocResource extends BasicRestServlet {
- private static final long serialVersionUID = 1L;
-
- @RestMethod(path="/test1")
- public Object test1() {
- return "OK";
- }
-
- @RestMethod(
- path="/test2",
- htmldoc=@HtmlDoc(
- aside={"aside2a","aside2b"},
- footer={"footer2a","footer2b"},
- header={"header2a","header2b"},
- nav={"nav2a","nav2b"},
- script={"script2a","script2b"},
- style={"style2a","style2b"},
- stylesheet="stylesheet2"
- )
- )
- public Object test2() {
- return "OK";
- }
-
- @RestMethod(
- path="/test3",
- htmldoc=@HtmlDoc(
- aside={"INHERIT","aside3a","aside3b"},
- footer={"INHERIT","footer3a","footer3b"},
- header={"INHERIT","header3a","header3b"},
- nav={"INHERIT","nav3a","nav3b"},
- script={"INHERIT","script3a","script3b"},
- style={"INHERIT","style3a","style3b"}
- )
- )
- public Object test3() {
- return "OK";
- }
-
- @RestMethod(
- path="/test4",
- htmldoc=@HtmlDoc(
- aside={"aside4a","INHERIT","aside4b"},
- footer={"footer4a","INHERIT","footer4b"},
- header={"header4a","INHERIT","header4b"},
- nav={"nav4a","INHERIT","nav4b"},
- script={"script4a","INHERIT","script4b"},
- style={"style4a","INHERIT","style4b"}
- )
- )
- public Object test4() {
- return "OK";
- }
-
- @RestMethod(
- path="/test5",
- htmldoc=@HtmlDoc(
- aside={"aside5a","aside5b","INHERIT"},
- footer={"footer5a","footer5b","INHERIT"},
- header={"header5a","header5b","INHERIT"},
- nav={"nav5a","nav5b","INHERIT"},
- script={"script5a","script5b","INHERIT"},
- style={"style5a","style5b","INHERIT"}
- )
- )
- public Object test5() {
- return "OK";
- }
-
- @RestResource(
- path="/testHtmlDoc2",
- htmldoc=@HtmlDoc(
- aside={"INHERIT","aside11a","aside11b"},
- footer={"footer11a","INHERIT","footer11b"},
- header={"header11a","header11b","INHERIT"},
- nav={"INHERIT","nav11a","nav11b"},
- script={"script11a","script11b"},
- style={"style11a","style11b"},
- stylesheet="stylesheet11"
- )
- )
- public static class HtmlDocResource2 extends HtmlDocResource {
- private static final long serialVersionUID = 1L;
-
- @RestMethod(path="/test11")
- public Object test11() {
- return "OK";
- }
-
- @RestMethod(
- path="/test12",
- htmldoc=@HtmlDoc(
- aside={"aside12a","aside12b"},
- footer={"footer12a","footer12b"},
- header={"header12a","header12b"},
- nav={"nav12a","nav12b"},
- script={"script12a","script12b"},
- style={"style12a","style12b"},
- stylesheet="stylesheet12"
- )
- )
- public Object test12() {
- return "OK";
- }
-
- @RestMethod(
- path="/test13",
- htmldoc=@HtmlDoc(
- aside={"INHERIT","aside13a","aside13b"},
- footer={"INHERIT","footer13a","footer13b"},
- header={"INHERIT","header13a","header13b"},
- nav={"INHERIT","nav13a","nav13b"},
- script={"INHERIT","script13a","script13b"},
- style={"INHERIT","style13a","style13b"}
- )
- )
- public Object test13() {
- return "OK";
- }
-
- @RestMethod(
- path="/test14",
- htmldoc=@HtmlDoc(
- aside={"aside14a","INHERIT","aside14b"},
- footer={"footer14a","INHERIT","footer14b"},
- header={"header14a","INHERIT","header14b"},
- nav={"nav14a","INHERIT","nav14b"},
- script={"script14a","INHERIT","script14b"},
- style={"style14a","INHERIT","style14b"}
- )
- )
- public Object test14() {
- return "OK";
- }
-
- @RestMethod(
- path="/test15",
- htmldoc=@HtmlDoc(
- aside={"aside15a","aside15b","INHERIT"},
- footer={"footer15a","footer15b","INHERIT"},
- header={"header15a","header15b","INHERIT"},
- nav={"nav15a","nav15b","INHERIT"},
- script={"script15a","script15b","INHERIT"},
- style={"style15a","style15b","INHERIT"}
- )
- )
- public Object test15() {
- return "OK";
- }
- }
-}
diff --git
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/Root.java
b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/Root.java
index 7e015b1..7ce5c65 100644
---
a/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/Root.java
+++
b/juneau-microservice/juneau-microservice-test/src/main/java/org/apache/juneau/rest/test/Root.java
@@ -30,8 +30,6 @@ import org.apache.juneau.rest.test.client.*;
ClientFuturesResource.class,
ConfigResource.class,
FormDataResource.class,
- HtmlDocResource.class,
- HtmlDocLinksResource.class,
InterfaceProxyResource.class,
LargePojosResource.class,
PathsResource.class,
diff --git
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocLinksTest.java
b/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocLinksTest.java
deleted file mode 100644
index f21e84f..0000000
---
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocLinksTest.java
+++ /dev/null
@@ -1,337 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.test;
-
-import static org.junit.Assert.*;
-
-import org.apache.juneau.rest.client.*;
-import org.junit.*;
-
-/**
- * Validates inheritance on the @HtmlDoc.navlinks() annotation.
- */
-public class HtmlDocLinksTest extends RestTestcase {
- private RestClient client = TestMicroservice.DEFAULT_CLIENT;
-
- private String get(String uri) throws Exception {
- return
client.doGet(uri).accept("text/html").getResponseAsString().replace('\n', '
').replace('"', '\'').replaceAll(".*<nav>", "<nav>").replaceAll("</nav>.*",
"</nav>");
- }
-
- /**
- * @RestResource(
- * path="/testHtmlDocLinks",
- * htmldoc=@HtmlDoc(
- * navlinks={"links1a","links1b"}
- * )
- * )
- */
- @Test
- public void test1() throws Exception {
- String r = get("/testHtmlDocLinks/test1");
-
assertEquals("<nav><ol><li>links1a</li><li>links1b</li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test2",
- * htmldoc=@HtmlDoc(
- * navlinks={"links2a","links2b"}
- * )
- * )
- */
- @Test
- public void test2() throws Exception {
- String r = get("/testHtmlDocLinks/test2");
-
assertEquals("<nav><ol><li>links2a</li><li>links2b</li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test3",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","links3a","links3b"}
- * )
- * )
- */
- @Test
- public void test3() throws Exception {
- String r = get("/testHtmlDocLinks/test3");
-
assertEquals("<nav><ol><li>links1a</li><li>links1b</li><li>links3a</li><li>links3b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test4",
- * htmldoc=@HtmlDoc(
- * navlinks={"links4a","INHERIT","links4b"}
- * )
- * )
- */
- @Test
- public void test4() throws Exception {
- String r = get("/testHtmlDocLinks/test4");
-
assertEquals("<nav><ol><li>links4a</li><li>links1a</li><li>links1b</li><li>links4b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test5",
- * htmldoc=@HtmlDoc(
- * navlinks={"links5a","links5b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test5() throws Exception {
- String r = get("/testHtmlDocLinks/test5");
-
assertEquals("<nav><ol><li>links5a</li><li>links5b</li><li>links1a</li><li>links1b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test6a",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","[0]:links6a","[3]:links6b"}
- * )
- * )
- */
- @Test
- public void test6a() throws Exception {
- String r = get("/testHtmlDocLinks/test6a");
-
assertEquals("<nav><ol><li>links6a</li><li>links1a</li><li>links1b</li><li>links6b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test6b",
- * htmldoc=@HtmlDoc(
- * navlinks={"[1]:links6a","[2]:links6b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test6b() throws Exception {
- String r = get("/testHtmlDocLinks/test6b");
-
assertEquals("<nav><ol><li>links6a</li><li>links6b</li><li>links1a</li><li>links1b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test6c",
- * htmldoc=@HtmlDoc(
- * navlinks={"[1]:links6a","[0]:links6b"}
- * )
- * )
- */
- @Test
- public void test6c() throws Exception {
- String r = get("/testHtmlDocLinks/test6c");
-
assertEquals("<nav><ol><li>links6b</li><li>links6a</li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test6d",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","foo[0]:links6a","bar[3]:links6b"}
- * )
- * )
- */
- @Test
- public void test6d() throws Exception {
- String r = get("/testHtmlDocLinks/test6d");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/links6a'>foo</a></li><li>links1a</li><li>links1b</li><li><a
href='/testHtmlDocLinks/links6b'>bar</a></li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test6e",
- * htmldoc=@HtmlDoc(
- * navlinks={"foo[1]:links6a","bar[2]:links6b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test6e() throws Exception {
- String r = get("/testHtmlDocLinks/test6e");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/links6a'>foo</a></li><li><a
href='/testHtmlDocLinks/links6b'>bar</a></li><li>links1a</li><li>links1b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test6f",
- * htmldoc=@HtmlDoc(
- * navlinks={"foo[1]:links6a","bar[0]:links6b"}
- * )
- * )
- */
- @Test
- public void test6f() throws Exception {
- String r = get("/testHtmlDocLinks/test6f");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/links6b'>bar</a></li><li><a
href='/testHtmlDocLinks/links6a'>foo</a></li></ol></nav>", r);
- }
-
- /**
- * @RestResource(
- * path="/testHtmlDocLinks2",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","links11a","links11b"}
- * )
- * )
- */
- @Test
- public void test11() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test11");
-
assertEquals("<nav><ol><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test12",
- * htmldoc=@HtmlDoc(
- * navlinks={"links12a","links12b"}
- * )
- * )
- */
- @Test
- public void test12() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test12");
-
assertEquals("<nav><ol><li>links12a</li><li>links12b</li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test13",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","links13a","links13b"}
- * )
- * )
- */
- @Test
- public void test13() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test13");
-
assertEquals("<nav><ol><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li><li>links13a</li><li>links13b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test14",
- * htmldoc=@HtmlDoc(
- * navlinks={"links14a","INHERIT","links14b"}
- * )
- * )
- */
- @Test
- public void test14() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test14");
-
assertEquals("<nav><ol><li>links14a</li><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li><li>links14b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test15",
- * htmldoc=@HtmlDoc(
- * navlinks={"links15a","links15b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test15() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test15");
-
assertEquals("<nav><ol><li>links15a</li><li>links15b</li><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test16a",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","[0]:links16a","[3]:links16b"}
- * )
- * )
- */
- @Test
- public void test16a() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16a");
-
assertEquals("<nav><ol><li>links16a</li><li>links1a</li><li>links1b</li><li>links16b</li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test16b",
- * htmldoc=@HtmlDoc(
- * navlinks={"[1]:links16a","[2]:links16b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test16b() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16b");
-
assertEquals("<nav><ol><li>links16a</li><li>links16b</li><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test16c",
- * htmldoc=@HtmlDoc(
- * navlinks={"[1]:links16a","[0]:links16b"}
- * )
- * )
- */
- @Test
- public void test16c() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16c");
-
assertEquals("<nav><ol><li>links16b</li><li>links16a</li></ol></nav>", r);
- }
-
- /**
- * @RestMethod(
- * path="/test16d",
- * htmldoc=@HtmlDoc(
- * navlinks={"INHERIT","foo[0]:links16a","bar[3]:links16b"}
- * )
- * )
- */
- @Test
- public void test16d() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16d");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16a'>foo</a></li><li>links1a</li><li>links1b</li><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16b'>bar</a></li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test16e",
- * htmldoc=@HtmlDoc(
- * navlinks={"foo[1]:links16a","bar[2]:links16b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test16e() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16e");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16a'>foo</a></li><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16b'>bar</a></li><li>links1a</li><li>links1b</li><li>links11a</li><li>links11b</li></ol></nav>",
r);
- }
-
- /**
- * @RestMethod(
- * path="/test16f",
- * htmldoc=@HtmlDoc(
- * navlinks={"foo[1]:links16a","bar[0]:links16b"}
- * )
- * )
- */
- @Test
- public void test16f() throws Exception {
- String r = get("/testHtmlDocLinks/testHtmlDocLinks2/test16f");
- assertEquals("<nav><ol><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16b'>bar</a></li><li><a
href='/testHtmlDocLinks/testHtmlDocLinks2/links16a'>foo</a></li></ol></nav>",
r);
- }
-}
diff --git
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocTest.java
b/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocTest.java
deleted file mode 100644
index 9a847fa..0000000
---
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/HtmlDocTest.java
+++ /dev/null
@@ -1,291 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.rest.test;
-
-import static org.junit.Assert.*;
-
-import org.apache.juneau.rest.client.*;
-import org.junit.*;
-
-/**
- * Validates inheritance on the @HtmlDoc annotation.
- */
-public class HtmlDocTest extends RestTestcase {
- private RestClient client = TestMicroservice.DEFAULT_CLIENT;
-
- private String get(String uri) throws Exception {
- return
client.doGet(uri).accept("text/html").getResponseAsString().replace('\n', '
').replace('"', '\'');
- }
- private String header(String r) {
- return r.substring(r.indexOf("<header>")+8,
r.indexOf("</header>"));
- }
- private String script(String r) {
- return r.substring(r.indexOf("<script>")+8,
r.indexOf("</script>"));
- }
- private String style(String r) {
- return r.substring(r.indexOf("<style>")+7,
r.indexOf("</style>"));
- }
- private String nav(String r) {
- return r.substring(r.indexOf("<nav>")+5, r.indexOf("</nav>"));
- }
- private String aside(String r) {
- return r.substring(r.indexOf("<aside>")+7,
r.indexOf("</aside>"));
- }
- private String footer(String r) {
- return r.substring(r.indexOf("<footer>")+8,
r.indexOf("</footer>"));
- }
-
- /**
- * @RestResource(
- * path="/testHtmlDoc",
- * htmldoc=@HtmlDoc(
- * aside={"aside1a","aside1b","INHERIT"},
- * footer={"footer1a","footer1b"},
- * header={"header1a","header1b"},
- * nav={"nav1a","nav1b"},
- * script={"script1a","script1b"},
- * style={"style1a","style1b"},
- * stylesheet="stylesheet1"
- * )
- * )
- */
- @Test
- public void test1() throws Exception {
- String r = get("/testHtmlDoc/test1");
- assertEquals("header1a header1b", header(r));
- assertEquals("script1a script1b ", script(r));
- assertEquals("@import '/testHtmlDoc/stylesheet1'; style1a
style1b", style(r));
- assertEquals("nav1a nav1b", nav(r));
- assertEquals("aside1a aside1b", aside(r));
- assertEquals("footer1a footer1b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test2",
- * htmldoc=@HtmlDoc(
- * aside={"aside2a","aside2b"},
- * footer={"footer2a","footer2b"},
- * header={"header2a","header2b"},
- * nav={"nav2a","nav2b"},
- * script={"script2a","script2b"},
- * style={"style2a","style2b"},
- * stylesheet="stylesheet2"
- * )
- * )
- */
- @Test
- public void test2() throws Exception {
- String r = get("/testHtmlDoc/test2");
- assertEquals("header2a header2b", header(r));
- assertEquals("script2a script2b ", script(r));
- assertEquals("@import '/testHtmlDoc/stylesheet2'; style2a
style2b", style(r));
- assertEquals("nav2a nav2b", nav(r));
- assertEquals("aside2a aside2b", aside(r));
- assertEquals("footer2a footer2b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test3",
- * htmldoc=@HtmlDoc(
- * aside={"INHERIT","aside3a","aside3b"},
- * footer={"INHERIT","footer3a","footer3b"},
- * header={"INHERIT","header3a","header3b"},
- * nav={"INHERIT","nav3a","nav3b"},
- * script={"INHERIT","script3a","script3b"},
- * style={"INHERIT","style3a","style3b"}
- * )
- * )
- */
- @Test
- public void test3() throws Exception {
- String r = get("/testHtmlDoc/test3");
- assertEquals("header1a header1b header3a header3b", header(r));
- assertEquals("script1a script1b script3a script3b ",
script(r));
- assertEquals("@import '/testHtmlDoc/stylesheet1'; style1a
style1b style3a style3b", style(r));
- assertEquals("nav1a nav1b nav3a nav3b", nav(r));
- assertEquals("aside1a aside1b aside3a aside3b", aside(r));
- assertEquals("footer1a footer1b footer3a footer3b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test4",
- * htmldoc=@HtmlDoc(
- * aside={"aside4a","INHERIT","aside4b"},
- * footer={"footer4a","INHERIT","footer4b"},
- * header={"header4a","INHERIT","header4b"},
- * nav={"nav4a","INHERIT","nav4b"},
- * script={"script4a","INHERIT","script4b"},
- * style={"style4a","INHERIT","style4b"}
- * )
- * )
- */
- @Test
- public void test4() throws Exception {
- String r = get("/testHtmlDoc/test4");
- assertEquals("header4a header1a header1b header4b", header(r));
- assertEquals("script4a script1a script1b script4b ",
script(r));
- assertEquals("@import '/testHtmlDoc/stylesheet1'; style4a
style1a style1b style4b", style(r));
- assertEquals("nav4a nav1a nav1b nav4b", nav(r));
- assertEquals("aside4a aside1a aside1b aside4b", aside(r));
- assertEquals("footer4a footer1a footer1b footer4b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test5",
- * htmldoc=@HtmlDoc(
- * aside={"aside5a","aside5b","INHERIT"},
- * footer={"footer5a","footer5b","INHERIT"},
- * header={"header5a","header5b","INHERIT"},
- * nav={"nav5a","nav5b","INHERIT"},
- * script={"script5a","script5b","INHERIT"},
- * style={"style5a","style5b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test5() throws Exception {
- String r = get("/testHtmlDoc/test5");
- assertEquals("header5a header5b header1a header1b", header(r));
- assertEquals("script5a script5b script1a script1b ",
script(r));
- assertEquals("@import '/testHtmlDoc/stylesheet1'; style5a
style5b style1a style1b", style(r));
- assertEquals("nav5a nav5b nav1a nav1b", nav(r));
- assertEquals("aside5a aside5b aside1a aside1b", aside(r));
- assertEquals("footer5a footer5b footer1a footer1b", footer(r));
- }
-
- /**
- * @RestResource(
- * path="/testHtmlDoc2",
- * htmldoc=@HtmlDoc(
- * aside={"INHERIT","aside11a","aside11b"},
- * footer={"footer11a","INHERIT","footer11b"},
- * header={"header11a","header11b","INHERIT"},
- * nav={"INHERIT","nav11a","nav11b"},
- * script={"script11a","script11b"},
- * style={"style11a","style11b"},
- * stylesheet="stylesheet11"
- * )
- * )
- */
- @Test
- public void test11() throws Exception {
- String r = get("/testHtmlDoc/testHtmlDoc2/test11");
- assertEquals("header11a header11b header1a header1b",
header(r));
- assertEquals("script11a script11b ", script(r));
- assertEquals("@import '/testHtmlDoc/testHtmlDoc2/stylesheet11';
style11a style11b", style(r));
- assertEquals("nav1a nav1b nav11a nav11b", nav(r));
- assertEquals("aside1a aside1b aside11a aside11b", aside(r));
- assertEquals("footer11a footer1a footer1b footer11b",
footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test12",
- * htmldoc=@HtmlDoc(
- * aside={"aside12a","aside12b"},
- * footer={"footer12a","footer12b"},
- * header={"header12a","header12b"},
- * nav={"nav12a","nav12b"},
- * script={"script12a","script12b"},
- * style={"style12a","style12b"},
- * stylesheet="stylesheet12"
- * )
- * )
- */
- @Test
- public void test12() throws Exception {
- String r = get("/testHtmlDoc/testHtmlDoc2/test12");
- assertEquals("header12a header12b", header(r));
- assertEquals("script12a script12b ", script(r));
- assertEquals("@import '/testHtmlDoc/testHtmlDoc2/stylesheet12';
style12a style12b", style(r));
- assertEquals("nav12a nav12b", nav(r));
- assertEquals("aside12a aside12b", aside(r));
- assertEquals("footer12a footer12b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test13",
- * htmldoc=@HtmlDoc(
- * aside={"INHERIT","aside13a","aside13b"},
- * footer={"INHERIT","footer13a","footer13b"},
- * header={"INHERIT","header13a","header13b"},
- * nav={"INHERIT","nav13a","nav13b"},
- * script={"INHERIT","script13a","script13b"},
- * style={"INHERIT","style13a","style13b"}
- * )
- * )
- */
- @Test
- public void test13() throws Exception {
- String r = get("/testHtmlDoc/testHtmlDoc2/test13");
- assertEquals("header11a header11b header1a header1b header13a
header13b", header(r));
- assertEquals("script11a script11b script13a script13b ",
script(r));
- assertEquals("@import '/testHtmlDoc/testHtmlDoc2/stylesheet11';
style11a style11b style13a style13b", style(r));
- assertEquals("nav1a nav1b nav11a nav11b nav13a nav13b", nav(r));
- assertEquals("aside1a aside1b aside11a aside11b aside13a
aside13b", aside(r));
- assertEquals("footer11a footer1a footer1b footer11b footer13a
footer13b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test14",
- * htmldoc=@HtmlDoc(
- * aside={"aside14a","INHERIT","aside14b"},
- * footer={"footer14a","INHERIT","footer14b"},
- * header={"header14a","INHERIT","header14b"},
- * nav={"nav14a","INHERIT","nav14b"},
- * script={"script14a","INHERIT","script14b"},
- * style={"style14a","INHERIT","style14b"}
- * )
- * )
- */
- @Test
- public void test14() throws Exception {
- String r = get("/testHtmlDoc/testHtmlDoc2/test14");
- assertEquals("header14a header11a header11b header1a header1b
header14b", header(r));
- assertEquals("script14a script11a script11b script14b ",
script(r));
- assertEquals("@import '/testHtmlDoc/testHtmlDoc2/stylesheet11';
style14a style11a style11b style14b", style(r));
- assertEquals("nav14a nav1a nav1b nav11a nav11b nav14b", nav(r));
- assertEquals("aside14a aside1a aside1b aside11a aside11b
aside14b", aside(r));
- assertEquals("footer14a footer11a footer1a footer1b footer11b
footer14b", footer(r));
- }
-
- /**
- * @RestMethod(
- * path="/test15",
- * htmldoc=@HtmlDoc(
- * aside={"aside15a","aside15b","INHERIT"},
- * footer={"footer15a","footer15b","INHERIT"},
- * header={"header15a","header15b","INHERIT"},
- * nav={"nav15a","nav15b","INHERIT"},
- * script={"script15a","script15b","INHERIT"},
- * style={"style15a","style15b","INHERIT"}
- * )
- * )
- */
- @Test
- public void test15() throws Exception {
- String r = get("/testHtmlDoc/testHtmlDoc2/test15");
- assertEquals("header15a header15b header11a header11b header1a
header1b", header(r));
- assertEquals("script15a script15b script11a script11b ",
script(r));
- assertEquals("@import '/testHtmlDoc/testHtmlDoc2/stylesheet11';
style15a style15b style11a style11b", style(r));
- assertEquals("nav15a nav15b nav1a nav1b nav11a nav11b", nav(r));
- assertEquals("aside15a aside15b aside1a aside1b aside11a
aside11b", aside(r));
- assertEquals("footer15a footer15b footer11a footer1a footer1b
footer11b", footer(r));
- }
-}
\ No newline at end of file
diff --git
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
b/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
index c83cba8..6f62d6c 100644
---
a/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
+++
b/juneau-microservice/juneau-microservice-test/src/test/java/org/apache/juneau/rest/test/_TestSuite.java
@@ -29,8 +29,6 @@ import org.junit.runners.Suite.*;
ClientFuturesTest.class,
ConfigTest.class,
FormDataTest.class,
- HtmlDocTest.class,
- HtmlDocLinksTest.class,
InterfaceProxyTest.class,
LargePojosTest.class,
PathsTest.class,
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
index 56966e8..9252be5 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/RestContextBuilder.java
@@ -1697,7 +1697,9 @@ public class RestContextBuilder extends
BeanContextBuilder implements ServletCon
* @return This object (for method chaining).
*/
public RestContextBuilder staticFiles(Class<?> baseClass, String
mappingString) {
- return staticFiles(new StaticFileMapping(baseClass,
mappingString));
+ if (! isEmpty(mappingString))
+ staticFiles(new StaticFileMapping(baseClass,
mappingString));
+ return this;
}
/**
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFileMapping.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFileMapping.java
index 5beab56..67cc0a6 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFileMapping.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/StaticFileMapping.java
@@ -113,14 +113,14 @@ public class StaticFileMapping {
this.resourceClass = resourceClass;
String[] parts = StringUtils.split(mappingString, ':', 3);
if (parts == null || parts.length <= 1)
- throw new FormattedRuntimeException("Invalid mapping
string format: ''{0}''", mappingString);
+ throw new FormattedRuntimeException("Invalid mapping
string format: ''{0}'' on resource class ''{1}''", mappingString,
resourceClass.getName());
this.path = StringUtils.trimSlashes(parts[0]);
this.location = StringUtils.trimSlashes(parts[1]);
if (parts.length == 3) {
try {
responseHeaders = unmodifiableMap(new
ObjectMap(parts[2]));
} catch (ParseException e) {
- throw new FormattedRuntimeException(e, "Invalid
mapping string format: ''{0}''", mappingString);
+ throw new FormattedRuntimeException(e, "Invalid
mapping string format: ''{0}'' on resource class ''{1}''", mappingString,
resourceClass.getName());
}
} else {
responseHeaders = null;
diff --git
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
index dd8028a..c3a6b97 100644
---
a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
+++
b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/mock/MockServletResponse.java
@@ -17,6 +17,7 @@ import static org.apache.juneau.internal.StringUtils.*;
import java.io.*;
import java.text.*;
import java.util.*;
+import java.util.regex.*;
import javax.servlet.*;
import javax.servlet.http.*;
@@ -279,7 +280,7 @@ public class MockServletResponse implements
HttpServletResponse {
*/
public MockServletResponse assertStatus(int status) throws
AssertionError {
if (getStatus() != status)
- throw new AssertionError(MessageFormat.format("Response
did not have the expected status. expected=[{0}], actual=[{1}]", status,
getStatus()));
+ throw new MockAssertionError("Response did not have the
expected status.\n\tExpected=[{0}]\n\tActual=[{1}]", status, getStatus());
return this;
}
@@ -292,7 +293,7 @@ public class MockServletResponse implements
HttpServletResponse {
*/
public MockServletResponse assertBody(String text) throws
AssertionError {
if (! StringUtils.isEquals(text, getBodyAsString()))
- throw new AssertionError(MessageFormat.format("Response
did not have the expected text. expected=[{0}], actual=[{1}]", text,
getBodyAsString()));
+ throw new MockAssertionError("Response did not have the
expected text.\n\tExpected=[{0}]\n\tActual=[{1}]", text, getBodyAsString());
return this;
}
@@ -307,7 +308,41 @@ public class MockServletResponse implements
HttpServletResponse {
String text = getBodyAsString();
for (String substring : substrings)
if (! contains(text, substring))
- throw new
AssertionError(MessageFormat.format("Response did not have the expected
substring. expected=[{0}], body=[{1}]", substring, text));
+ throw new MockAssertionError("Response did not
have the expected substring.\n\tExpected=[{0}]\n\tBody=[{1}]", substring, text);
+ return this;
+ }
+
+ /**
+ * Throws an {@link AssertionError} if the response body does not match
the specified pattern.
+ *
+ * <p>
+ * A pattern is a simple string containing <js>"*"</js> to represent
zero or more arbitrary characters.
+ *
+ * @param pattern The pattern to match against.
+ * @return This object (for method chaining).
+ * @throws AssertionError Thrown if the body does not match the
specified pattern.
+ */
+ public MockServletResponse assertBodyMatches(String pattern) throws
AssertionError {
+ String text = getBodyAsString();
+ if (! getMatchPattern(pattern).matcher(text).matches())
+ throw new MockAssertionError("Response did not match
expected pattern.\n\tPattern=[{0}]\n\tBody=[{1}]", pattern, text);
+ return this;
+ }
+
+ /**
+ * Throws an {@link AssertionError} if the response body does not match
the specified regular expression.
+ *
+ * <p>
+ * A pattern is a simple string containing <js>"*"</js> to represent
zero or more arbitrary characters.
+ *
+ * @param regExp The regular expression to match against.
+ * @return This object (for method chaining).
+ * @throws AssertionError Thrown if the body does not match the
specified regular expression.
+ */
+ public MockServletResponse assertBodyMatchesRE(String regExp) throws
AssertionError {
+ String text = getBodyAsString();
+ if (! Pattern.compile(regExp).matcher(text).matches())
+ throw new MockAssertionError("Response did not match
expected regular expression.\n\tRegExp=[{0}]\n\tBody=[{1}]", regExp, text);
return this;
}
@@ -320,7 +355,7 @@ public class MockServletResponse implements
HttpServletResponse {
*/
public MockServletResponse assertCharset(String value) {
if (! StringUtils.isEquals(value, getCharacterEncoding()))
- throw new AssertionError(MessageFormat.format("Response
did not have the expected character encoding. expected=[{0}], actual=[{1}]",
value, getBodyAsString()));
+ throw new MockAssertionError("Response did not have the
expected character encoding.\n\tExpected=[{0}]\n\tActual=[{1}]", value,
getBodyAsString());
return this;
}
@@ -334,7 +369,7 @@ public class MockServletResponse implements
HttpServletResponse {
*/
public MockServletResponse assertHeader(String name, String value) {
if (! StringUtils.isEquals(value, getHeader(name)))
- throw new AssertionError(MessageFormat.format("Response
did not have the expected value for header {0}. expected=[{1}], actual=[{2}]",
name, value, getHeader(name)));
+ throw new MockAssertionError("Response did not have the
expected value for header {0}.\n\tExpected=[{1}]\n\tActual=[{2}]", name, value,
getHeader(name));
return this;
}
@@ -350,7 +385,7 @@ public class MockServletResponse implements
HttpServletResponse {
String text = getHeader(name);
for (String substring : substrings)
if (! contains(text, substring))
- throw new
AssertionError(MessageFormat.format("Response did not have the expected
substring in header {0}. expected=[{1}], header=[{2}]", name, substring, text));
+ throw new MockAssertionError("Response did not
have the expected substring in header {0}.\n\tExpected=[{1}]\n\tHeader=[{2}]",
name, substring, text);
return this;
}
@@ -362,4 +397,13 @@ public class MockServletResponse implements
HttpServletResponse {
public byte[] getBody() {
return baos.toByteArray();
}
+
+ private static class MockAssertionError extends AssertionError {
+ private static final long serialVersionUID = 1L;
+
+ MockAssertionError(String msg, Object...args) {
+ super(MessageFormat.format(msg, args));
+ System.err.println(getMessage());
+ }
+ }
}
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocAsideTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocAsideTest.java
new file mode 100644
index 0000000..90ede5a
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocAsideTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(aside) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocAsideTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(aside={"a01a","a01b","INHERIT"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(aside={"a02a","a02b"}))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(aside={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(aside={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(aside={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<aside>a01a
a01b</aside>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<aside>a02a
a02b</aside>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<aside>a01a a01b a03a
a03b</aside>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<aside>a04a a01a a01b
a04b</aside>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<aside>a05a a05b a01a
a01b</aside>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(aside={"INHERIT","b01a","b01b"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(aside={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(aside={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(aside={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(aside={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<aside>a01a a01b b01a
b01b</aside>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<aside>b02a
b02b</aside>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<aside>a01a a01b b01a
b01b b03a b03b</aside>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<aside>b04a a01a a01b
b01a b01b b04b</aside>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<aside>b05a b05b a01a
a01b b01a b01b</aside>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocFooterTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocFooterTest.java
new file mode 100644
index 0000000..763acb0
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocFooterTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(footer) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocFooterTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(footer={"a01a","a01b"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(footer={"a02a","a02b"}))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(footer={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(footer={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(footer={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<footer>a01a
a01b</footer>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<footer>a02a
a02b</footer>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<footer>a01a a01b
a03a a03b</footer>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<footer>a04a a01a
a01b a04b</footer>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<footer>a05a a05b
a01a a01b</footer>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(footer={"b01a","INHERIT","b01b"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(footer={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(footer={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(footer={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(footer={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<footer>b01a a01a
a01b b01b</footer>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<footer>b02a
b02b</footer>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<footer>b01a a01a
a01b b01b b03a b03b</footer>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<footer>b04a b01a
a01a a01b b01b b04b</footer>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<footer>b05a b05b
b01a a01a a01b b01b</footer>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocHeaderTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocHeaderTest.java
new file mode 100644
index 0000000..6317786
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocHeaderTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(header) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocHeaderTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(header={"a01a","a01b"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(header={"a02a","a02b"}))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(header={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(header={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(header={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<header>a01a
a01b</header>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<header>a02a
a02b</header>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<header>a01a a01b
a03a a03b</header>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<header>a04a a01a
a01b a04b</header>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<header>a05a a05b
a01a a01b</header>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(header={"b01a","b01b","INHERIT"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(header={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(header={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(header={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(header={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<header>b01a b01b
a01a a01b</header>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<header>b02a
b02b</header>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<header>b01a b01b
a01a a01b b03a b03b</header>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<header>b04a b01a
b01b a01a a01b b04b</header>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<header>b05a b05b
b01a b01b a01a a01b</header>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavTest.java
new file mode 100644
index 0000000..b38a7b7
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(nav) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocNavTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(navlinks={"NONE"},nav={"a01a","a01b"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02", htmldoc=@HtmlDoc(nav={"a02a","a02b"}))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(nav={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(nav={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(nav={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<nav>a01a
a01b</nav>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<nav>a02a
a02b</nav>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<nav>a01a a01b a03a
a03b</nav>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<nav>a04a a01a a01b
a04b</nav>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<nav>a05a a05b a01a
a01b</nav>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(nav={"INHERIT","b01a","b01b"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02", htmldoc=@HtmlDoc(nav={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(nav={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(nav={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(nav={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<nav>a01a a01b b01a
b01b</nav>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<nav>b02a
b02b</nav>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<nav>a01a a01b b01a
b01b b03a b03b</nav>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<nav>b04a a01a a01b
b01a b01b b04b</nav>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<nav>b05a b05b a01a
a01b b01a b01b</nav>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavlinksTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavlinksTest.java
new file mode 100644
index 0000000..166ed18
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocNavlinksTest.java
@@ -0,0 +1,224 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(navlinks) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocNavlinksTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(navlinks={"a01a","a01b"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(navlinks={"a02a","a02b"}))
+ public Object test2() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(navlinks={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(navlinks={"a04a","INHERIT","a04b"}))
+ public Object test4() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(navlinks={"a05a","a05b","INHERIT"}))
+ public Object test5() {
+ return "OK";
+ }
+ @RestMethod(path="/a06",
htmldoc=@HtmlDoc(navlinks={"INHERIT","[0]:a06a","[3]:a06b"}))
+ public Object test6a() {
+ return "OK";
+ }
+ @RestMethod(path="/a07",
htmldoc=@HtmlDoc(navlinks={"[1]:a07a","[2]:a07b","INHERIT"}))
+ public Object test6b() {
+ return "OK";
+ }
+ @RestMethod(path="/a08",
htmldoc=@HtmlDoc(navlinks={"[1]:a08a","[0]:a08b"}))
+ public Object test6c() {
+ return "OK";
+ }
+ @RestMethod(path="/a09",
htmldoc=@HtmlDoc(navlinks={"INHERIT","foo[0]:a09a","bar[3]:a09b"}))
+ public Object test6d() {
+ return "OK";
+ }
+ @RestMethod(path="/a10",
htmldoc=@HtmlDoc(navlinks={"foo[1]:a10a","bar[2]:a10b","INHERIT"}))
+ public Object test6e() {
+ return "OK";
+ }
+ @RestMethod(path="/a11",
htmldoc=@HtmlDoc(navlinks={"foo[1]:a11a","bar[0]:a11b"}))
+ public Object test6f() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<nav><ol><li>a01a</li><li>a01b</li></ol></nav>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<nav><ol><li>a02a</li><li>a02b</li></ol></nav>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<nav><ol><li>a01a</li><li>a01b</li><li>a03a</li><li>a03b</li></ol></nav>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<nav><ol><li>a04a</li><li>a01a</li><li>a01b</li><li>a04b</li></ol></nav>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<nav><ol><li>a05a</li><li>a05b</li><li>a01a</li><li>a01b</li></ol></nav>");
+ }
+ @Test
+ public void a06() throws Exception {
+ a.request("GET",
"/a06").accept("text/html").execute().assertBodyContains("<nav><ol><li>a06a</li><li>a01a</li><li>a01b</li><li>a06b</li></ol></nav>");
+ }
+ @Test
+ public void a07() throws Exception {
+ a.request("GET",
"/a07").accept("text/html").execute().assertBodyContains("<nav><ol><li>a07a</li><li>a07b</li><li>a01a</li><li>a01b</li></ol></nav>");
+ }
+ @Test
+ public void a08() throws Exception {
+ a.request("GET",
"/a08").accept("text/html").execute().assertBodyContains("<nav><ol><li>a08b</li><li>a08a</li></ol></nav>");
+ }
+ @Test
+ public void a09() throws Exception {
+ a.request("GET",
"/a09").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/a09a\">foo</a></li><li>a01a</li><li>a01b</li><li><a
href=\"/a09b\">bar</a></li></ol></nav>");
+ }
+ @Test
+ public void a10() throws Exception {
+ a.request("GET",
"/a10").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/a10a\">foo</a></li><li><a
href=\"/a10b\">bar</a></li><li>a01a</li><li>a01b</li></ol></nav>");
+ }
+ @Test
+ public void a11() throws Exception {
+ a.request("GET",
"/a11").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/a11b\">bar</a></li><li><a href=\"/a11a\">foo</a></li></ol></nav>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(navlinks={"INHERIT","b01a","b01b"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(navlinks={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(navlinks={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(navlinks={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(navlinks={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ @RestMethod(path="/b06",
htmldoc=@HtmlDoc(navlinks={"INHERIT","[0]:b06a","[3]:b06b"}))
+ public Object b06() {
+ return "OK";
+ }
+ @RestMethod(path="/b07",
htmldoc=@HtmlDoc(navlinks={"[1]:b07a","[2]:b07b","INHERIT"}))
+ public Object b07() {
+ return "OK";
+ }
+ @RestMethod(path="/b08",
htmldoc=@HtmlDoc(navlinks={"[1]:b08a","[0]:b08b"}))
+ public Object b08() {
+ return "OK";
+ }
+ @RestMethod(path="/b09",
htmldoc=@HtmlDoc(navlinks={"INHERIT","foo[0]:b09a","bar[3]:b09b"}))
+ public Object b09() {
+ return "OK";
+ }
+ @RestMethod(path="/b10",
htmldoc=@HtmlDoc(navlinks={"foo[1]:b10a","bar[2]:b10b","INHERIT"}))
+ public Object b10() {
+ return "OK";
+ }
+ @RestMethod(path="/b11",
htmldoc=@HtmlDoc(navlinks={"foo[1]:b11a","bar[0]:b11b"}))
+ public Object b11() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<nav><ol><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<nav><ol><li>b02a</li><li>b02b</li></ol></nav>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<nav><ol><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li><li>b03a</li><li>b03b</li></ol></nav>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<nav><ol><li>b04a</li><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li><li>b04b</li></ol></nav>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<nav><ol><li>b05a</li><li>b05b</li><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b06() throws Exception {
+ b.request("GET",
"/b06").accept("text/html").execute().assertBodyContains("<nav><ol><li>b06a</li><li>a01a</li><li>a01b</li><li>b06b</li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b07() throws Exception {
+ b.request("GET",
"/b07").accept("text/html").execute().assertBodyContains("<nav><ol><li>b07a</li><li>b07b</li><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b08() throws Exception {
+ b.request("GET",
"/b08").accept("text/html").execute().assertBodyContains("<nav><ol><li>b08b</li><li>b08a</li></ol></nav>");
+ }
+ @Test
+ public void b09() throws Exception {
+ b.request("GET",
"/b09").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/b09a\">foo</a></li><li>a01a</li><li>a01b</li><li><a
href=\"/b09b\">bar</a></li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b10() throws Exception {
+ b.request("GET",
"/b10").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/b10a\">foo</a></li><li><a
href=\"/b10b\">bar</a></li><li>a01a</li><li>a01b</li><li>b01a</li><li>b01b</li></ol></nav>");
+ }
+ @Test
+ public void b11() throws Exception {
+ b.request("GET",
"/b11").accept("text/html").execute().assertBodyContains("<nav><ol><li><a
href=\"/b11b\">bar</a></li><li><a href=\"/b11a\">foo</a></li></ol></nav>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocScriptTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocScriptTest.java
new file mode 100644
index 0000000..b62faf7
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocScriptTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(script) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocScriptTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(script={"a01a","a01b"}))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(script={"a02a","a02b"}))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(script={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(script={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(script={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<script>a01a\n
a01b\n</script>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<script>a02a\n
a02b\n</script>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<script>a01a\n a01b\n
a03a\n a03b\n</script>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<script>a04a\n a01a\n
a01b\n a04b\n</script>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<script>a05a\n a05b\n
a01a\n a01b\n</script>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(script={"b01a","b01b"}))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(script={"b02a","b02b"}))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(script={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(script={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(script={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<script>b01a\n
b01b\n</script>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<script>b02a\n
b02b\n</script>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<script>b01a\n b01b\n
b03a\n b03b\n</script>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<script>b04a\n b01a\n
b01b\n b04b\n</script>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<script>b05a\n b05b\n
b01a\n b01b\n</script>");
+ }
+}
\ No newline at end of file
diff --git
a/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocStyleTest.java
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocStyleTest.java
new file mode 100644
index 0000000..82aa3a1
--- /dev/null
+++
b/juneau-rest/juneau-rest-server/src/test/java/org/apache/juneau/rest/annotation/HtmlDocStyleTest.java
@@ -0,0 +1,126 @@
+//
***************************************************************************************************************************
+// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
+// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
+// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
+// * with the License. You may obtain a copy of the License at
*
+// *
*
+// * http://www.apache.org/licenses/LICENSE-2.0
*
+// *
*
+// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
+// * specific language governing permissions and limitations under the
License. *
+//
***************************************************************************************************************************
+package org.apache.juneau.rest.annotation;
+
+import org.apache.juneau.rest.*;
+import org.apache.juneau.rest.mock.*;
+import org.junit.*;
+import org.junit.runners.*;
+
+/**
+ * Tests related to @HtmlDoc(style) annotation.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+@SuppressWarnings({"javadoc","serial"})
+public class HtmlDocStyleTest {
+
+
//=================================================================================================================
+ // Basic tests
+
//=================================================================================================================
+
+
@RestResource(htmldoc=@HtmlDoc(style={"a01a","a01b"},stylesheet="a01s",nowrap="false"))
+ public static class A extends BasicRestServlet {
+ @RestMethod(path="/a01")
+ public Object a01() {
+ return "OK";
+ }
+ @RestMethod(path="/a02",
htmldoc=@HtmlDoc(style={"a02a","a02b"},stylesheet="a02s"))
+ public Object a02() {
+ return "OK";
+ }
+ @RestMethod(path="/a03",
htmldoc=@HtmlDoc(style={"INHERIT","a03a","a03b"}))
+ public Object a03() {
+ return "OK";
+ }
+ @RestMethod(path="/a04",
htmldoc=@HtmlDoc(style={"a04a","INHERIT","a04b"}))
+ public Object a04() {
+ return "OK";
+ }
+ @RestMethod(path="/a05",
htmldoc=@HtmlDoc(style={"a05a","a05b","INHERIT"}))
+ public Object a05() {
+ return "OK";
+ }
+ }
+ static MockRest a = MockRest.create(A.class);
+
+ @Test
+ public void a01() throws Exception {
+ a.request("GET",
"/a01").accept("text/html").execute().assertBodyContains("<style>@import
\"/a01s\"; a01a a01b</style>");
+ }
+ @Test
+ public void a02() throws Exception {
+ a.request("GET",
"/a02").accept("text/html").execute().assertBodyContains("<style>@import
\"/a02s\"; a02a a02b</style>");
+ }
+ @Test
+ public void a03() throws Exception {
+ a.request("GET",
"/a03").accept("text/html").execute().assertBodyContains("<style>@import
\"/a01s\"; a01a a01b a03a a03b</style>");
+ }
+ @Test
+ public void a04() throws Exception {
+ a.request("GET",
"/a04").accept("text/html").execute().assertBodyContains("<style>@import
\"/a01s\"; a04a a01a a01b a04b</style>");
+ }
+ @Test
+ public void a05() throws Exception {
+ a.request("GET",
"/a05").accept("text/html").execute().assertBodyContains("<style>@import
\"/a01s\"; a05a a05b a01a a01b</style>");
+ }
+
+
//=================================================================================================================
+ // Inheritance
+
//=================================================================================================================
+
+ @RestResource(htmldoc=@HtmlDoc(style={"b01a","b01b"},stylesheet="b01s"))
+ public static class B extends A {
+ @RestMethod(path="/b01")
+ public Object b01() {
+ return "OK";
+ }
+ @RestMethod(path="/b02",
htmldoc=@HtmlDoc(style={"b02a","b02b"},stylesheet="b02s"))
+ public Object b02() {
+ return "OK";
+ }
+ @RestMethod(path="/b03",
htmldoc=@HtmlDoc(style={"INHERIT","b03a","b03b"}))
+ public Object b03() {
+ return "OK";
+ }
+ @RestMethod(path="/b04",
htmldoc=@HtmlDoc(style={"b04a","INHERIT","b04b"}))
+ public Object b04() {
+ return "OK";
+ }
+ @RestMethod(path="/b05",
htmldoc=@HtmlDoc(style={"b05a","b05b","INHERIT"}))
+ public Object b05() {
+ return "OK";
+ }
+ }
+ static MockRest b = MockRest.create(B.class);
+
+ @Test
+ public void b01() throws Exception {
+ b.request("GET",
"/b01").accept("text/html").execute().assertBodyContains("<style>@import
\"/b01s\"; b01a b01b</style>");
+ }
+ @Test
+ public void b02() throws Exception {
+ b.request("GET",
"/b02").accept("text/html").execute().assertBodyContains("<style>@import
\"/b02s\"; b02a b02b</style>");
+ }
+ @Test
+ public void b03() throws Exception {
+ b.request("GET",
"/b03").accept("text/html").execute().assertBodyContains("<style>@import
\"/b01s\"; b01a b01b b03a b03b</style>");
+ }
+ @Test
+ public void b04() throws Exception {
+ b.request("GET",
"/b04").accept("text/html").execute().assertBodyContains("<style>@import
\"/b01s\"; b04a b01a b01b b04b</style>");
+ }
+ @Test
+ public void b05() throws Exception {
+ b.request("GET",
"/b05").accept("text/html").execute().assertBodyContains("<style>@import
\"/b01s\"; b05a b05b b01a b01b</style>");
+ }
+}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
[email protected].