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 d87da6d Tests.
d87da6d is described below
commit d87da6dc09cb2bc9bac1c091467b04cbf5b71978
Author: JamesBognar <[email protected]>
AuthorDate: Tue Aug 28 13:37:20 2018 -0400
Tests.
---
juneau-doc/src/main/javadoc/overview.html | 27 ++--
.../rest/client/remote/FormDataAnnotationTest.java | 171 ++++++++++++++++++++
.../rest/client/remote/HeaderAnnotationTest.java | 172 +++++++++++++++++++++
.../rest/client/remote/PathAnnotationTest.java | 172 +++++++++++++++++++++
.../rest/client/remote/QueryAnnotationTest.java | 170 ++++++++++++++++++++
5 files changed, 700 insertions(+), 12 deletions(-)
diff --git a/juneau-doc/src/main/javadoc/overview.html
b/juneau-doc/src/main/javadoc/overview.html
index 761bf18..7338bc5 100644
--- a/juneau-doc/src/main/javadoc/overview.html
+++ b/juneau-doc/src/main/javadoc/overview.html
@@ -134,7 +134,7 @@
<li><p class=''><a class='doclink'
href='#juneau-marshall.ReadingContinuousStreams'>Reading Continuous
Streams</a></p>
<li><p class='updated'><a class='doclink'
href='#juneau-marshall.URIs'>URIs</a></p>
<li><p class=''><a class='doclink'
href='#juneau-marshall.JacksonComparison'>Comparison with Jackson</a></p>
- <li><p class=''><a class='doclink'
href='#juneau-marshall.PojoCategories'>POJO Categories</a></p>
+ <li><p class='updated'><a class='doclink'
href='#juneau-marshall.PojoCategories'>POJO Categories</a></p>
<li><p class=''><a class='doclink'
href='#juneau-marshall.JsonDetails'>JSON Details</a></p>
<ol>
<li><p class=''><a class='doclink'
href='#juneau-marshall.JsonDetails.Methodology'>JSON Methodology</a></p>
@@ -188,8 +188,8 @@
<li><p class='new'><a class='doclink'
href='#juneau-marshall.OpenApiDetails'>OpenAPI Details</a></p>
<ol>
<li><p class='new'><a class='doclink'
href='#juneau-marshall.OpenApiDetails.Methodology'>OpenAPI Methodology</a></p>
- <li><p class='new'><a class='doclink'
href='#juneau-marshall.OpenApiDetails.Serializers'>OpenAPI Serializers</a></p>
- <li><p class='new'><a class='doclink'
href='#juneau-marshall.OpenApiDetails.Parsers'>OpenAPI Parsers</a></p>
+ <li><p class='todo'><a class='doclink'
href='#juneau-marshall.OpenApiDetails.Serializers'>OpenAPI Serializers</a></p>
+ <li><p class='todo'><a class='doclink'
href='#juneau-marshall.OpenApiDetails.Parsers'>OpenAPI Parsers</a></p>
</ol>
<li><p class=''><a class='doclink'
href='#juneau-marshall.BestPractices'>Best Practices</a></p>
</ol>
@@ -3996,7 +3996,7 @@
<!--
====================================================================================================
-->
-<h3 class='topic ' onclick='toggle(this)'><a
href='#juneau-marshall.PojoCategories' id='juneau-marshall.PojoCategories'>2.18
- POJO Categories</a></h3>
+<h3 class='topic updated' onclick='toggle(this)'><a
href='#juneau-marshall.PojoCategories' id='juneau-marshall.PojoCategories'>2.18
- POJO Categories</a></h3>
<div class='topic'><!-- START: 2.18 - juneau-marshall.PojoCategories -->
<p>
The following chart shows POJOs categorized into groups and whether
they can be serialized or parsed:
@@ -8662,6 +8662,8 @@
<li class='ja'>{@link org.apache.juneau.http.annotation.Query Query}
<li class='ja'>{@link org.apache.juneau.http.annotation.FormData
FormData}
<li class='ja'>{@link org.apache.juneau.http.annotation.Path Path}
+ <li class='ja'>{@link org.apache.juneau.http.annotation.Response
Response}
+ <li class='ja'>{@link org.apache.juneau.http.annotation.ResponseHeader
ResponseHeader}
</ul>
<!--
====================================================================================================
-->
@@ -8812,7 +8814,7 @@
<!--
====================================================================================================
-->
-<h4 class='topic new' onclick='toggle(this)'><a
href='#juneau-marshall.OpenApiDetails.Serializers'
id='juneau-marshall.OpenApiDetails.Serializers'>2.25.2 - OpenAPI
Serializers</a></h4>
+<h4 class='topic todo' onclick='toggle(this)'><a
href='#juneau-marshall.OpenApiDetails.Serializers'
id='juneau-marshall.OpenApiDetails.Serializers'>2.25.2 - OpenAPI
Serializers</a></h4>
<div class='topic'><!-- START: 2.25.2 -
juneau-marshall.OpenApiDetails.Serializers -->
<p>
The {@link org.apache.juneau.oapi.OpenApiSerializer} class is used to
convert POJOs to HTTP parts.
@@ -9251,7 +9253,7 @@
<!--
====================================================================================================
-->
-<h4 class='topic new' onclick='toggle(this)'><a
href='#juneau-marshall.OpenApiDetails.Parsers'
id='juneau-marshall.OpenApiDetails.Parsers'>2.25.3 - OpenAPI Parsers</a></h4>
+<h4 class='topic todo' onclick='toggle(this)'><a
href='#juneau-marshall.OpenApiDetails.Parsers'
id='juneau-marshall.OpenApiDetails.Parsers'>2.25.3 - OpenAPI Parsers</a></h4>
<div class='topic'><!-- START: 2.25.3 - juneau-marshall.OpenApiDetails.Parsers
-->
<p>
The {@link org.apache.juneau.oapi.OpenApiParser} class is used to
convert HTTP parts back into POJOs.
@@ -15208,8 +15210,8 @@
<ja>@RestMethod</ja>(method=<js>"POST"</js>, path=<js>"/testBody"</js>)
<jk>public void</jk> testBody(
<ja>@Body</ja>(
- serializers=OpenApiSerializer.<jk>class</jk>,
- defaultAccept=<js>"text/openapi"</js>,
+ parsers=OpenApiParser.<jk>class</jk>,
+ defaultContentType=<js>"text/openapi"</js>,
schema=<ja>@Schema</ja>(
items=<ja>@Items</ja>(
collectionFormat=<js>"pipes"</js>,
@@ -16803,7 +16805,7 @@
}
</p>
<p>
- The <code><ja>@Response</ja>(schema)</code> can be used to define the
format of the output using OpenAPI-based rules.
+ The <code><ja>@Response</ja>(schema)</code> annotation can be used to
define the format of the output using OpenAPI-based rules.
</p>
<p class='bpcode w800'>
<ja>@RestResource</ja>
@@ -31320,13 +31322,14 @@ TODO(7.2.0)
<li class='jc'>{@link
org.apache.juneau.httppart.HttpPartType}
<li class='jic'>{@link
org.apache.juneau.httppart.HttpPartSerializer}
<ul>
- <li class='jc'>{@link
org.apache.juneau.uon.UonSerializer}
+ <li
class='jc'><code><del>UonPartSerializer</del></code>
+ <li
class='jc'><code><del>SimpleUonPartSerializer}
<li class='jc'>{@link
org.apache.juneau.httppart.SimplePartSerializer}
</ul>
<li class='jic'>{@link
org.apache.juneau.httppart.HttpPartParser}
<ul>
- <li class='jc'>{@link
org.apache.juneau.uon.UonParser}
- <li class='jc'>{@link
org.apache.juneau.httppart.SimplePartParser}
+ <li
class='jc'><code><del>UonPartParser</del></code>
+ <li
class='jc'><code><del>SimplePartParser</del></code>
</ul>
</ul>
</ul>
diff --git
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
index 78be420..eec6e52 100644
---
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
+++
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/FormDataAnnotationTest.java
@@ -346,6 +346,7 @@ public class FormDataAnnotationTest {
@RemoteMethod(path="/") String
postC01a(@FormData(name="x",minimum="1",maximum="10") int b);
@RemoteMethod(path="/") String
postC01b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
int b);
@RemoteMethod(path="/") String
postC01c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
int b);
+ @RemoteMethod(path="/") String
postC01d(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
int b);
@RemoteMethod(path="/") String
postC02a(@FormData(name="x",minimum="1",maximum="10") short b);
@RemoteMethod(path="/") String
postC02b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
short b);
@RemoteMethod(path="/") String
postC02c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
short b);
@@ -761,4 +762,174 @@ public class FormDataAnnotationTest {
assertEquals("{x:'1|2'}", er.postE06(new String[]{"1","2"}));
try { assertEquals("{x:'1|1'}", er.postE06(new
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items
not allowed"); }
}
+
+
//=================================================================================================================
+ // @FormData(maxLength,minLength,enum,pattern)
+
//=================================================================================================================
+
+ @RestResource
+ public static class F {
+ @RestMethod
+ public String post(@FormData("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest f = MockRest.create(F.class);
+
+ @RemoteResource
+ public static interface FR {
+ @RemoteMethod(path="/") String
postF01(@FormData(name="x",minLength=2,maxLength=3) String b);
+ @RemoteMethod(path="/") String
postF02(@FormData(name="x",collectionFormat="pipes",items=@Items(minLength=2,maxLength=3))
String...b);
+ @RemoteMethod(path="/") String
postF03(@FormData(name="x",_enum={"foo"}) String b);
+ @RemoteMethod(path="/") String
postF04(@FormData(name="x",collectionFormat="pipes",items=@Items(_enum={"foo"}))
String...b);
+ @RemoteMethod(path="/") String
postF05(@FormData(name="x",pattern="foo\\d{1,3}") String b);
+ @RemoteMethod(path="/") String
postF06(@FormData(name="x",collectionFormat="pipes",items=@Items(pattern="foo\\d{1,3}"))
String...b);
+ }
+
+ private static FR fr =
RestClient.create().mockHttpConnection(f).build().getRemoteResource(FR.class);
+
+ @Test
+ public void f01_minMaxLength() throws Exception {
+ assertEquals("{x:'12'}", fr.postF01("12"));
+ assertEquals("{x:'123'}", fr.postF01("123"));
+ try { fr.postF01("1"); } catch (Exception e) {
assertContains(e, "Minimum length of value not met"); }
+ try { fr.postF01("1234"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{}", fr.postF01(null));
+ }
+ @Test
+ public void f02_minMaxLength_items() throws Exception {
+ assertEquals("{x:'12|34'}", fr.postF02("12","34"));
+ assertEquals("{x:'123|456'}", fr.postF02("123","456"));
+ try { fr.postF02("1","2"); } catch (Exception e) {
assertContains(e, "Minimum length of value not met"); }
+ try { fr.postF02("1234","5678"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{x:'12|null'}", fr.postF02("12",null));
+ }
+ @Test
+ public void f03_enum() throws Exception {
+ assertEquals("{x:'foo'}", fr.postF03("foo"));
+ try { fr.postF03("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values"); }
+ assertEquals("{}", fr.postF03(null));
+ }
+ @Test
+ public void f04_enum_items() throws Exception {
+ assertEquals("{x:'foo'}", fr.postF04("foo"));
+ try { fr.postF04("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values"); }
+ assertEquals("{x:'null'}", fr.postF04((String)null));
+ }
+ @Test
+ public void f05_pattern() throws Exception {
+ assertEquals("{x:'foo123'}", fr.postF05("foo123"));
+ try { fr.postF05("bar"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{}", fr.postF05(null));
+ }
+ @Test
+ public void f06_pattern_items() throws Exception {
+ assertEquals("{x:'foo123'}", fr.postF06("foo123"));
+ try { fr.postF06("foo"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{x:'null'}", fr.postF06((String)null));
+ }
+
+
//=================================================================================================================
+ // @FormData(multipleOf)
+
//=================================================================================================================
+
+ @RestResource
+ public static class G {
+ @RestMethod
+ public String post(@FormData("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest g = MockRest.create(G.class);
+
+ @RemoteResource
+ public static interface GR {
+ @RemoteMethod(path="/") String
postG01(@FormData(name="x",multipleOf="2") int b);
+ @RemoteMethod(path="/") String
postG02(@FormData(name="x",multipleOf="2") short b);
+ @RemoteMethod(path="/") String
postG03(@FormData(name="x",multipleOf="2") long b);
+ @RemoteMethod(path="/") String
postG04(@FormData(name="x",multipleOf="2") float b);
+ @RemoteMethod(path="/") String
postG05(@FormData(name="x",multipleOf="2") double b);
+ @RemoteMethod(path="/") String
postG06(@FormData(name="x",multipleOf="2") byte b);
+ @RemoteMethod(path="/") String
postG07(@FormData(name="x",multipleOf="2") AtomicInteger b);
+ @RemoteMethod(path="/") String
postG08(@FormData(name="x",multipleOf="2") BigDecimal b);
+ @RemoteMethod(path="/") String
postG11(@FormData(name="x",multipleOf="2") Integer b);
+ @RemoteMethod(path="/") String
postG12(@FormData(name="x",multipleOf="2") Short b);
+ @RemoteMethod(path="/") String
postG13(@FormData(name="x",multipleOf="2") Long b);
+ @RemoteMethod(path="/") String
postG14(@FormData(name="x",multipleOf="2") Float b);
+ @RemoteMethod(path="/") String
postG15(@FormData(name="x",multipleOf="2") Double b);
+ @RemoteMethod(path="/") String
postG16(@FormData(name="x",multipleOf="2") Byte b);
+ }
+
+ private static GR gr =
RestClient.create().mockHttpConnection(g).build().getRemoteResource(GR.class);
+
+ @Test
+ public void g01_multipleOf_int() throws Exception {
+ assertEquals("{x:'4'}", gr.postG01(4));
+ try { gr.postG01(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g02_multipleOf_short() throws Exception {
+ assertEquals("{x:'4'}", gr.postG02((short)4));
+ try { gr.postG02((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g03_multipleOf_long() throws Exception {
+ assertEquals("{x:'4'}", gr.postG03(4));
+ try { gr.postG03(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g04_multipleOf_float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.postG04(4));
+ try { gr.postG04(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g05_multipleOf_double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.postG05(4));
+ try { gr.postG05(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g06_multipleOf_byte() throws Exception {
+ assertEquals("{x:'4'}", gr.postG06((byte)4));
+ try { gr.postG06((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g07_multipleOf_AtomicInteger() throws Exception {
+ assertEquals("{x:'4'}", gr.postG07(new AtomicInteger(4)));
+ try { gr.postG07(new AtomicInteger(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g08_multipleOf_BigDecimal() throws Exception {
+ assertEquals("{x:'4'}", gr.postG08(new BigDecimal(4)));
+ try { gr.postG08(new BigDecimal(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g11_multipleOf_Integer() throws Exception {
+ assertEquals("{x:'4'}", gr.postG11(4));
+ try { gr.postG11(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g12_multipleOf_Short() throws Exception {
+ assertEquals("{x:'4'}", gr.postG12((short)4));
+ try { gr.postG12((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g13_multipleOf_Long() throws Exception {
+ assertEquals("{x:'4'}", gr.postG13(4l));
+ try { gr.postG13(5l); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g14_multipleOf_Float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.postG14(4f));
+ try { gr.postG14(5f); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g15_multipleOf_Double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.postG15(4d));
+ try { gr.postG15(5d); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g16_multipleOf_Byte() throws Exception {
+ assertEquals("{x:'4'}", gr.postG16((byte)4));
+ try { gr.postG16((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
}
diff --git
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
index 72a8afd..287f710 100644
---
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
+++
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/HeaderAnnotationTest.java
@@ -704,4 +704,176 @@ public class HeaderAnnotationTest {
assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
try { assertEquals("{x:'1|1'}", er.getE06(new
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items
not allowed"); }
}
+
+
//=================================================================================================================
+ // @Header(maxLength,minLength,enum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class F {
+ @RestMethod
+ public String get(@Header("*") ObjectMap m) {
+
m.removeAll("Accept-Encoding","Connection","Host","User-Agent");
+ return m.toString();
+ }
+ }
+ private static MockRest f = MockRest.create(F.class);
+
+ @RemoteResource
+ public static interface FR {
+ @RemoteMethod(path="/") String
getF01(@Header(name="x",minLength=2,maxLength=3) String b);
+ @RemoteMethod(path="/") String
getF02(@Header(name="x",collectionFormat="pipes",items=@Items(minLength=2,maxLength=3))
String...b);
+ @RemoteMethod(path="/") String
getF03(@Header(name="x",_enum={"foo"}) String b);
+ @RemoteMethod(path="/") String
getF04(@Header(name="x",collectionFormat="pipes",items=@Items(_enum={"foo"}))
String...b);
+ @RemoteMethod(path="/") String
getF05(@Header(name="x",pattern="foo\\d{1,3}") String b);
+ @RemoteMethod(path="/") String
getF06(@Header(name="x",collectionFormat="pipes",items=@Items(pattern="foo\\d{1,3}"))
String...b);
+ }
+
+ private static FR fr =
RestClient.create().mockHttpConnection(f).build().getRemoteResource(FR.class);
+
+ @Test
+ public void f01_minMaxLength() throws Exception {
+ assertEquals("{x:'12'}", fr.getF01("12"));
+ assertEquals("{x:'123'}", fr.getF01("123"));
+ try { fr.getF01("1"); } catch (Exception e) { assertContains(e,
"Minimum length of value not met"); }
+ try { fr.getF01("1234"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{}", fr.getF01(null));
+ }
+ @Test
+ public void f02_minMaxLength_items() throws Exception {
+ assertEquals("{x:'12|34'}", fr.getF02("12","34"));
+ assertEquals("{x:'123|456'}", fr.getF02("123","456"));
+ try { fr.getF02("1","2"); } catch (Exception e) {
assertContains(e, "Minimum length of value not met"); }
+ try { fr.getF02("1234","5678"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{x:'12|null'}", fr.getF02("12",null));
+ }
+ @Test
+ public void f03_enum() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF03("foo"));
+ try { fr.getF03("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{}", fr.getF03(null));
+ }
+ @Test
+ public void f04_enum_items() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF04("foo"));
+ try { fr.getF04("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{x:'null'}", fr.getF04((String)null));
+ }
+ @Test
+ public void f05_pattern() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF05("foo123"));
+ try { fr.getF05("bar"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{}", fr.getF05(null));
+ }
+ @Test
+ public void f06_pattern_items() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF06("foo123"));
+ try { fr.getF06("foo"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{x:'null'}", fr.getF06((String)null));
+ }
+
+
//=================================================================================================================
+ // @Header(multipleOf)
+
//=================================================================================================================
+
+ @RestResource
+ public static class G {
+ @RestMethod
+ public String get(@Header("*") ObjectMap m) {
+
m.removeAll("Accept-Encoding","Connection","Host","User-Agent");
+ return m.toString();
+ }
+ }
+ private static MockRest g = MockRest.create(G.class);
+
+ @RemoteResource
+ public static interface GR {
+ @RemoteMethod(path="/") String
getG01(@Header(name="x",multipleOf="2") int b);
+ @RemoteMethod(path="/") String
getG02(@Header(name="x",multipleOf="2") short b);
+ @RemoteMethod(path="/") String
getG03(@Header(name="x",multipleOf="2") long b);
+ @RemoteMethod(path="/") String
getG04(@Header(name="x",multipleOf="2") float b);
+ @RemoteMethod(path="/") String
getG05(@Header(name="x",multipleOf="2") double b);
+ @RemoteMethod(path="/") String
getG06(@Header(name="x",multipleOf="2") byte b);
+ @RemoteMethod(path="/") String
getG07(@Header(name="x",multipleOf="2") AtomicInteger b);
+ @RemoteMethod(path="/") String
getG08(@Header(name="x",multipleOf="2") BigDecimal b);
+ @RemoteMethod(path="/") String
getG11(@Header(name="x",multipleOf="2") Integer b);
+ @RemoteMethod(path="/") String
getG12(@Header(name="x",multipleOf="2") Short b);
+ @RemoteMethod(path="/") String
getG13(@Header(name="x",multipleOf="2") Long b);
+ @RemoteMethod(path="/") String
getG14(@Header(name="x",multipleOf="2") Float b);
+ @RemoteMethod(path="/") String
getG15(@Header(name="x",multipleOf="2") Double b);
+ @RemoteMethod(path="/") String
getG16(@Header(name="x",multipleOf="2") Byte b);
+ }
+
+ private static GR gr =
RestClient.create().mockHttpConnection(g).build().getRemoteResource(GR.class);
+
+ @Test
+ public void g01_multipleOf_int() throws Exception {
+ assertEquals("{x:'4'}", gr.getG01(4));
+ try { gr.getG01(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g02_multipleOf_short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG02((short)4));
+ try { gr.getG02((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g03_multipleOf_long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG03(4));
+ try { gr.getG03(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g04_multipleOf_float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG04(4));
+ try { gr.getG04(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g05_multipleOf_double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG05(4));
+ try { gr.getG05(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g06_multipleOf_byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG06((byte)4));
+ try { gr.getG06((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g07_multipleOf_AtomicInteger() throws Exception {
+ assertEquals("{x:'4'}", gr.getG07(new AtomicInteger(4)));
+ try { gr.getG07(new AtomicInteger(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g08_multipleOf_BigDecimal() throws Exception {
+ assertEquals("{x:'4'}", gr.getG08(new BigDecimal(4)));
+ try { gr.getG08(new BigDecimal(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g11_multipleOf_Integer() throws Exception {
+ assertEquals("{x:'4'}", gr.getG11(4));
+ try { gr.getG11(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g12_multipleOf_Short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG12((short)4));
+ try { gr.getG12((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g13_multipleOf_Long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG13(4l));
+ try { gr.getG13(5l); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g14_multipleOf_Float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG14(4f));
+ try { gr.getG14(5f); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g15_multipleOf_Double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG15(4d));
+ try { gr.getG15(5d); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g16_multipleOf_Byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG16((byte)4));
+ try { gr.getG16((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
}
diff --git
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
index bcb56be..b193194 100644
---
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
+++
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/PathAnnotationTest.java
@@ -638,4 +638,176 @@ public class PathAnnotationTest {
assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
try { assertEquals("{x:'1|1'}", er.getE06(new
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items
not allowed"); }
}
+
+
//=================================================================================================================
+ // @Path(maxLength,minLength,enum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class F {
+ @RestMethod(path="/{x}")
+ public String get(@Path("*") ObjectMap m) {
+ m.removeAll("/*","/**");
+ return m.toString();
+ }
+ }
+ private static MockRest f = MockRest.create(F.class);
+
+ @RemoteResource
+ public static interface FR {
+ @RemoteMethod(path="/{x}") String
getF01(@Path(name="x",minLength=2,maxLength=3) String b);
+ @RemoteMethod(path="/{x}") String
getF02(@Path(name="x",collectionFormat="pipes",items=@Items(minLength=2,maxLength=3))
String...b);
+ @RemoteMethod(path="/{x}") String
getF03(@Path(name="x",_enum={"foo"}) String b);
+ @RemoteMethod(path="/{x}") String
getF04(@Path(name="x",collectionFormat="pipes",items=@Items(_enum={"foo"}))
String...b);
+ @RemoteMethod(path="/{x}") String
getF05(@Path(name="x",pattern="foo\\d{1,3}") String b);
+ @RemoteMethod(path="/{x}") String
getF06(@Path(name="x",collectionFormat="pipes",items=@Items(pattern="foo\\d{1,3}"))
String...b);
+ }
+
+ private static FR fr =
RestClient.create().mockHttpConnection(f).build().getRemoteResource(FR.class);
+
+ @Test
+ public void f01_minMaxLength() throws Exception {
+ assertEquals("{x:'12'}", fr.getF01("12"));
+ assertEquals("{x:'123'}", fr.getF01("123"));
+ try { fr.getF01("1"); } catch (Exception e) { assertContains(e,
"Minimum length of value not met"); }
+ try { fr.getF01("1234"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{x:'null'}", fr.getF01(null));
+ }
+ @Test
+ public void f02_minMaxLength_items() throws Exception {
+ assertEquals("{x:'12|34'}", fr.getF02("12","34"));
+ assertEquals("{x:'123|456'}", fr.getF02("123","456"));
+ try { fr.getF02("1","2"); } catch (Exception e) {
assertContains(e, "Minimum length of value not met"); }
+ try { fr.getF02("1234","5678"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{x:'12|null'}", fr.getF02("12",null));
+ }
+ @Test
+ public void f03_enum() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF03("foo"));
+ try { fr.getF03("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{x:'null'}", fr.getF03(null));
+ }
+ @Test
+ public void f04_enum_items() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF04("foo"));
+ try { fr.getF04("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{x:'null'}", fr.getF04((String)null));
+ }
+ @Test
+ public void f05_pattern() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF05("foo123"));
+ try { fr.getF05("bar"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{x:'null'}", fr.getF05(null));
+ }
+ @Test
+ public void f06_pattern_items() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF06("foo123"));
+ try { fr.getF06("foo"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{x:'null'}", fr.getF06((String)null));
+ }
+
+
//=================================================================================================================
+ // @Path(multipleOf)
+
//=================================================================================================================
+
+ @RestResource
+ public static class G {
+ @RestMethod(path="/{x}")
+ public String get(@Path("*") ObjectMap m) {
+ m.removeAll("/*","/**");
+ return m.toString();
+ }
+ }
+ private static MockRest g = MockRest.create(G.class);
+
+ @RemoteResource
+ public static interface GR {
+ @RemoteMethod(path="/{x}") String
getG01(@Path(name="x",multipleOf="2") int b);
+ @RemoteMethod(path="/{x}") String
getG02(@Path(name="x",multipleOf="2") short b);
+ @RemoteMethod(path="/{x}") String
getG03(@Path(name="x",multipleOf="2") long b);
+ @RemoteMethod(path="/{x}") String
getG04(@Path(name="x",multipleOf="2") float b);
+ @RemoteMethod(path="/{x}") String
getG05(@Path(name="x",multipleOf="2") double b);
+ @RemoteMethod(path="/{x}") String
getG06(@Path(name="x",multipleOf="2") byte b);
+ @RemoteMethod(path="/{x}") String
getG07(@Path(name="x",multipleOf="2") AtomicInteger b);
+ @RemoteMethod(path="/{x}") String
getG08(@Path(name="x",multipleOf="2") BigDecimal b);
+ @RemoteMethod(path="/{x}") String
getG11(@Path(name="x",multipleOf="2") Integer b);
+ @RemoteMethod(path="/{x}") String
getG12(@Path(name="x",multipleOf="2") Short b);
+ @RemoteMethod(path="/{x}") String
getG13(@Path(name="x",multipleOf="2") Long b);
+ @RemoteMethod(path="/{x}") String
getG14(@Path(name="x",multipleOf="2") Float b);
+ @RemoteMethod(path="/{x}") String
getG15(@Path(name="x",multipleOf="2") Double b);
+ @RemoteMethod(path="/{x}") String
getG16(@Path(name="x",multipleOf="2") Byte b);
+ }
+
+ private static GR gr =
RestClient.create().mockHttpConnection(g).build().getRemoteResource(GR.class);
+
+ @Test
+ public void g01_multipleOf_int() throws Exception {
+ assertEquals("{x:'4'}", gr.getG01(4));
+ try { gr.getG01(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g02_multipleOf_short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG02((short)4));
+ try { gr.getG02((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g03_multipleOf_long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG03(4));
+ try { gr.getG03(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g04_multipleOf_float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG04(4));
+ try { gr.getG04(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g05_multipleOf_double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG05(4));
+ try { gr.getG05(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g06_multipleOf_byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG06((byte)4));
+ try { gr.getG06((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g07_multipleOf_AtomicInteger() throws Exception {
+ assertEquals("{x:'4'}", gr.getG07(new AtomicInteger(4)));
+ try { gr.getG07(new AtomicInteger(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g08_multipleOf_BigDecimal() throws Exception {
+ assertEquals("{x:'4'}", gr.getG08(new BigDecimal(4)));
+ try { gr.getG08(new BigDecimal(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g11_multipleOf_Integer() throws Exception {
+ assertEquals("{x:'4'}", gr.getG11(4));
+ try { gr.getG11(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g12_multipleOf_Short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG12((short)4));
+ try { gr.getG12((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g13_multipleOf_Long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG13(4l));
+ try { gr.getG13(5l); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g14_multipleOf_Float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG14(4f));
+ try { gr.getG14(5f); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g15_multipleOf_Double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG15(4d));
+ try { gr.getG15(5d); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g16_multipleOf_Byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG16((byte)4));
+ try { gr.getG16((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
}
diff --git
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
index 14ed20a..71ed71b 100644
---
a/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
+++
b/juneau-rest/juneau-rest-client/src/test/java/org/apache/juneau/rest/client/remote/QueryAnnotationTest.java
@@ -761,4 +761,174 @@ public class QueryAnnotationTest {
assertEquals("{x:'1|2'}", er.getE06(new String[]{"1","2"}));
try { assertEquals("{x:'1|1'}", er.getE06(new
String[]{"1","1"})); } catch (Exception e) { assertContains(e, "Duplicate items
not allowed"); }
}
+
+
//=================================================================================================================
+ // @Query(maxLength,minLength,enum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class F {
+ @RestMethod
+ public String get(@Query("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest f = MockRest.create(F.class);
+
+ @RemoteResource
+ public static interface FR {
+ @RemoteMethod(path="/") String
getF01(@Query(name="x",minLength=2,maxLength=3) String b);
+ @RemoteMethod(path="/") String
getF02(@Query(name="x",collectionFormat="pipes",items=@Items(minLength=2,maxLength=3))
String...b);
+ @RemoteMethod(path="/") String
getF03(@Query(name="x",_enum={"foo"}) String b);
+ @RemoteMethod(path="/") String
getF04(@Query(name="x",collectionFormat="pipes",items=@Items(_enum={"foo"}))
String...b);
+ @RemoteMethod(path="/") String
getF05(@Query(name="x",pattern="foo\\d{1,3}") String b);
+ @RemoteMethod(path="/") String
getF06(@Query(name="x",collectionFormat="pipes",items=@Items(pattern="foo\\d{1,3}"))
String...b);
+ }
+
+ private static FR fr =
RestClient.create().mockHttpConnection(f).build().getRemoteResource(FR.class);
+
+ @Test
+ public void f01_minMaxLength() throws Exception {
+ assertEquals("{x:'12'}", fr.getF01("12"));
+ assertEquals("{x:'123'}", fr.getF01("123"));
+ try { fr.getF01("1"); } catch (Exception e) { assertContains(e,
"Minimum length of value not met"); }
+ try { fr.getF01("1234"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{}", fr.getF01(null));
+ }
+ @Test
+ public void f02_minMaxLength_items() throws Exception {
+ assertEquals("{x:'12|34'}", fr.getF02("12","34"));
+ assertEquals("{x:'123|456'}", fr.getF02("123","456"));
+ try { fr.getF02("1","2"); } catch (Exception e) {
assertContains(e, "Minimum length of value not met"); }
+ try { fr.getF02("1234","5678"); } catch (Exception e) {
assertContains(e, "Maximum length of value exceeded"); }
+ assertEquals("{x:'12|null'}", fr.getF02("12",null));
+ }
+ @Test
+ public void f03_enum() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF03("foo"));
+ try { fr.getF03("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{}", fr.getF03(null));
+ }
+ @Test
+ public void f04_enum_items() throws Exception {
+ assertEquals("{x:'foo'}", fr.getF04("foo"));
+ try { fr.getF04("bar"); } catch (Exception e) {
assertContains(e, "Value does not match one of the expected values. Must be
one of the following: ['foo']"); }
+ assertEquals("{x:'null'}", fr.getF04((String)null));
+ }
+ @Test
+ public void f05_pattern() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF05("foo123"));
+ try { fr.getF05("bar"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{}", fr.getF05(null));
+ }
+ @Test
+ public void f06_pattern_items() throws Exception {
+ assertEquals("{x:'foo123'}", fr.getF06("foo123"));
+ try { fr.getF06("foo"); } catch (Exception e) {
assertContains(e, "Value does not match expected pattern"); }
+ assertEquals("{x:'null'}", fr.getF06((String)null));
+ }
+
+
//=================================================================================================================
+ // @Query(multipleOf)
+
//=================================================================================================================
+
+ @RestResource
+ public static class G {
+ @RestMethod
+ public String get(@Query("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest g = MockRest.create(G.class);
+
+ @RemoteResource
+ public static interface GR {
+ @RemoteMethod(path="/") String
getG01(@Query(name="x",multipleOf="2") int b);
+ @RemoteMethod(path="/") String
getG02(@Query(name="x",multipleOf="2") short b);
+ @RemoteMethod(path="/") String
getG03(@Query(name="x",multipleOf="2") long b);
+ @RemoteMethod(path="/") String
getG04(@Query(name="x",multipleOf="2") float b);
+ @RemoteMethod(path="/") String
getG05(@Query(name="x",multipleOf="2") double b);
+ @RemoteMethod(path="/") String
getG06(@Query(name="x",multipleOf="2") byte b);
+ @RemoteMethod(path="/") String
getG07(@Query(name="x",multipleOf="2") AtomicInteger b);
+ @RemoteMethod(path="/") String
getG08(@Query(name="x",multipleOf="2") BigDecimal b);
+ @RemoteMethod(path="/") String
getG11(@Query(name="x",multipleOf="2") Integer b);
+ @RemoteMethod(path="/") String
getG12(@Query(name="x",multipleOf="2") Short b);
+ @RemoteMethod(path="/") String
getG13(@Query(name="x",multipleOf="2") Long b);
+ @RemoteMethod(path="/") String
getG14(@Query(name="x",multipleOf="2") Float b);
+ @RemoteMethod(path="/") String
getG15(@Query(name="x",multipleOf="2") Double b);
+ @RemoteMethod(path="/") String
getG16(@Query(name="x",multipleOf="2") Byte b);
+ }
+
+ private static GR gr =
RestClient.create().mockHttpConnection(g).build().getRemoteResource(GR.class);
+
+ @Test
+ public void g01_multipleOf_int() throws Exception {
+ assertEquals("{x:'4'}", gr.getG01(4));
+ try { gr.getG01(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g02_multipleOf_short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG02((short)4));
+ try { gr.getG02((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g03_multipleOf_long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG03(4));
+ try { gr.getG03(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g04_multipleOf_float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG04(4));
+ try { gr.getG04(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g05_multipleOf_double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG05(4));
+ try { gr.getG05(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g06_multipleOf_byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG06((byte)4));
+ try { gr.getG06((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g07_multipleOf_AtomicInteger() throws Exception {
+ assertEquals("{x:'4'}", gr.getG07(new AtomicInteger(4)));
+ try { gr.getG07(new AtomicInteger(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g08_multipleOf_BigDecimal() throws Exception {
+ assertEquals("{x:'4'}", gr.getG08(new BigDecimal(4)));
+ try { gr.getG08(new BigDecimal(5)); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g11_multipleOf_Integer() throws Exception {
+ assertEquals("{x:'4'}", gr.getG11(4));
+ try { gr.getG11(5); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g12_multipleOf_Short() throws Exception {
+ assertEquals("{x:'4'}", gr.getG12((short)4));
+ try { gr.getG12((short)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
+ @Test
+ public void g13_multipleOf_Long() throws Exception {
+ assertEquals("{x:'4'}", gr.getG13(4l));
+ try { gr.getG13(5l); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g14_multipleOf_Float() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG14(4f));
+ try { gr.getG14(5f); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g15_multipleOf_Double() throws Exception {
+ assertEquals("{x:'4.0'}", gr.getG15(4d));
+ try { gr.getG15(5d); } catch (Exception e) { assertContains(e,
"Multiple-of not met"); }
+ }
+ @Test
+ public void g16_multipleOf_Byte() throws Exception {
+ assertEquals("{x:'4'}", gr.getG16((byte)4));
+ try { gr.getG16((byte)5); } catch (Exception e) {
assertContains(e, "Multiple-of not met"); }
+ }
}