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 b15317d Tests.
b15317d is described below
commit b15317daec16f26d1a0f6a71f8e5c910beddad48
Author: JamesBognar <[email protected]>
AuthorDate: Mon Aug 27 21:03:20 2018 -0400
Tests.
---
.../rest/client/remote/FormDataAnnotationTest.java | 376 ++++++++++++++++++++
.../rest/client/remote/HeaderAnnotationTest.java | 377 ++++++++++++++++++++
.../rest/client/remote/PathAnnotationTest.java | 379 +++++++++++++++++++++
.../rest/client/remote/QueryAnnotationTest.java | 376 ++++++++++++++++++++
4 files changed, 1508 insertions(+)
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 3ae3e18..d2b5fc3 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
@@ -16,7 +16,9 @@ import static org.junit.Assert.*;
import static org.apache.juneau.testutils.TestUtils.*;
import java.io.*;
+import java.math.*;
import java.util.*;
+import java.util.concurrent.atomic.*;
import org.apache.juneau.*;
import org.apache.juneau.http.annotation.*;
@@ -325,4 +327,378 @@ public class FormDataAnnotationTest {
public void c07b_uon_raw() throws Exception {
assertEquals("x=%40%28foo%2Cbar%29", cr.postC07b("foo","bar"));
}
+
+
//=================================================================================================================
+ // @FormData(maximum,exclusiveMaximum,minimum,exclusiveMinimum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class D {
+ @RestMethod
+ public String post(@FormData("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest d = MockRest.create(D.class);
+
+ @RemoteResource
+ public static interface DR {
+ @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
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);
+ @RemoteMethod(path="/") String
postC03a(@FormData(name="x",minimum="1",maximum="10") long b);
+ @RemoteMethod(path="/") String
postC03b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
long b);
+ @RemoteMethod(path="/") String
postC03c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
long b);
+ @RemoteMethod(path="/") String
postC04a(@FormData(name="x",minimum="1",maximum="10") float b);
+ @RemoteMethod(path="/") String
postC04b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
float b);
+ @RemoteMethod(path="/") String
postC04c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
float b);
+ @RemoteMethod(path="/") String
postC05a(@FormData(name="x",minimum="1",maximum="10") double b);
+ @RemoteMethod(path="/") String
postC05b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
double b);
+ @RemoteMethod(path="/") String
postC05c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
double b);
+ @RemoteMethod(path="/") String
postC06a(@FormData(name="x",minimum="1",maximum="10") byte b);
+ @RemoteMethod(path="/") String
postC06b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
byte b);
+ @RemoteMethod(path="/") String
postC06c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
byte b);
+ @RemoteMethod(path="/") String
postC07a(@FormData(name="x",minimum="1",maximum="10") AtomicInteger b);
+ @RemoteMethod(path="/") String
postC07b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
AtomicInteger b);
+ @RemoteMethod(path="/") String
postC07c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
AtomicInteger b);
+ @RemoteMethod(path="/") String
postC08a(@FormData(name="x",minimum="1",maximum="10") BigDecimal b);
+ @RemoteMethod(path="/") String
postC08b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
BigDecimal b);
+ @RemoteMethod(path="/") String
postC08c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
BigDecimal b);
+ @RemoteMethod(path="/") String
postC11a(@FormData(name="x",minimum="1",maximum="10") Integer b);
+ @RemoteMethod(path="/") String
postC11b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Integer b);
+ @RemoteMethod(path="/") String
postC11c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Integer b);
+ @RemoteMethod(path="/") String
postC12a(@FormData(name="x",minimum="1",maximum="10") Short b);
+ @RemoteMethod(path="/") String
postC12b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Short b);
+ @RemoteMethod(path="/") String
postC12c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Short b);
+ @RemoteMethod(path="/") String
postC13a(@FormData(name="x",minimum="1",maximum="10") Long b);
+ @RemoteMethod(path="/") String
postC13b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Long b);
+ @RemoteMethod(path="/") String
postC13c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Long b);
+ @RemoteMethod(path="/") String
postC14a(@FormData(name="x",minimum="1",maximum="10") Float b);
+ @RemoteMethod(path="/") String
postC14b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Float b);
+ @RemoteMethod(path="/") String
postC14c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Float b);
+ @RemoteMethod(path="/") String
postC15a(@FormData(name="x",minimum="1",maximum="10") Double b);
+ @RemoteMethod(path="/") String
postC15b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Double b);
+ @RemoteMethod(path="/") String
postC15c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Double b);
+ @RemoteMethod(path="/") String
postC16a(@FormData(name="x",minimum="1",maximum="10") Byte b);
+ @RemoteMethod(path="/") String
postC16b(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Byte b);
+ @RemoteMethod(path="/") String
postC16c(@FormData(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Byte b);
+ }
+
+ private static DR dr =
RestClient.create().mockHttpConnection(d).build().getRemoteResource(DR.class);
+
+ @Test
+ public void d01a_int_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC01a(1));
+ assertEquals("{x:'10'}", dr.postC01a(10));
+ try { dr.postC01a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC01a(11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d01b_int_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC01b(1));
+ assertEquals("{x:'10'}", dr.postC01b(10));
+ try { dr.postC01b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC01b(11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d01c_int_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC01c(2));
+ assertEquals("{x:'9'}", dr.postC01c(9));
+ try { dr.postC01c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC01c(10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02a_short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC02a((short)1));
+ assertEquals("{x:'10'}", dr.postC02a((short)10));
+ try { dr.postC02a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC02a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02b_short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC02b((short)1));
+ assertEquals("{x:'10'}", dr.postC02b((short)10));
+ try { dr.postC02b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC02b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02c_short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC02c((short)2));
+ assertEquals("{x:'9'}", dr.postC02c((short)9));
+ try { dr.postC02c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC02c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03a_long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC03a(1l));
+ assertEquals("{x:'10'}", dr.postC03a(10l));
+ try { dr.postC03a(0l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC03a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03b_long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC03b(1l));
+ assertEquals("{x:'10'}", dr.postC03b(10l));
+ try { dr.postC03b(0l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC03b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03c_long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC03c(2l));
+ assertEquals("{x:'9'}", dr.postC03c(9l));
+ try { dr.postC03c(1l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC03c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04a_float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC04a(1f));
+ assertEquals("{x:'10.0'}", dr.postC04a(10f));
+ try { dr.postC04a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC04a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04b_float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC04b(1f));
+ assertEquals("{x:'10.0'}", dr.postC04b(10f));
+ try { dr.postC04b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC04b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04c_float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.postC04c(1.1f));
+ assertEquals("{x:'9.9'}", dr.postC04c(9.9f));
+ try { dr.postC04c(1f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC04c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05a_double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC05a(1d));
+ assertEquals("{x:'10.0'}", dr.postC05a(10d));
+ try { dr.postC05a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC05a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05b_double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC05b(1d));
+ assertEquals("{x:'10.0'}", dr.postC05b(10d));
+ try { dr.postC05b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC05b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05c_double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.postC05c(1.1d));
+ assertEquals("{x:'9.9'}", dr.postC05c(9.9d));
+ try { dr.postC05c(1d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC05c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06a_byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC06a((byte)1));
+ assertEquals("{x:'10'}", dr.postC06a((byte)10));
+ try { dr.postC06a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC06a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06b_byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC06b((byte)1));
+ assertEquals("{x:'10'}", dr.postC06b((byte)10));
+ try { dr.postC06b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC06b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06c_byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC06c((byte)2));
+ assertEquals("{x:'9'}", dr.postC06c((byte)9));
+ try { dr.postC06c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC06c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07a_AtomicInteger_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC07a(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.postC07a(new AtomicInteger(10)));
+ try { dr.postC07a(new AtomicInteger(0)); } catch (Exception e)
{ assertContains(e, "Minimum value not met"); }
+ try { dr.postC07a(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07b_AtomicInteger_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC07b(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.postC07b(new AtomicInteger(10)));
+ try { dr.postC07b(new AtomicInteger(0)); } catch (Exception e)
{ assertContains(e, "Minimum value not met"); }
+ try { dr.postC07b(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07c_AtomicInteger_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC07c(new AtomicInteger(2)));
+ assertEquals("{x:'9'}", dr.postC07c(new AtomicInteger(9)));
+ try { dr.postC07c(new AtomicInteger(1)); } catch (Exception e)
{ assertContains(e, "Minimum value not met"); }
+ try { dr.postC07c(new AtomicInteger(10)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08a_BigDecimal_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC08a(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.postC08a(new BigDecimal(10)));
+ try { dr.postC08a(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC08a(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08b_BigDecimal_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC08b(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.postC08b(new BigDecimal(10)));
+ try { dr.postC08b(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC08b(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08cBigDecimal_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC08c(new BigDecimal(2)));
+ assertEquals("{x:'9'}", dr.postC08c(new BigDecimal(9)));
+ try { dr.postC08c(new BigDecimal(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC08c(new BigDecimal(10)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d11a_Integer_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC11a(1));
+ assertEquals("{x:'10'}", dr.postC11a(10));
+ try { dr.postC11a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC11a(11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC11a(null));
+ }
+ @Test
+ public void d11b_Integer_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC11b(1));
+ assertEquals("{x:'10'}", dr.postC11b(10));
+ try { dr.postC11b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC11b(11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC11b(null));
+ }
+ @Test
+ public void d11c_Integer_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC11c(2));
+ assertEquals("{x:'9'}", dr.postC11c(9));
+ try { dr.postC11c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.postC11c(10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC11c(null));
+ }
+ @Test
+ public void d12a_Short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC12a((short)1));
+ assertEquals("{x:'10'}", dr.postC12a((short)10));
+ try { dr.postC12a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC12a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC12a(null));
+ }
+ @Test
+ public void d12b_Short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC12b((short)1));
+ assertEquals("{x:'10'}", dr.postC12b((short)10));
+ try { dr.postC12b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC12b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC12b(null));
+ }
+ @Test
+ public void d12c_Short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC12c((short)2));
+ assertEquals("{x:'9'}", dr.postC12c((short)9));
+ try { dr.postC12c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC12c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC12c(null));
+ }
+ @Test
+ public void d13a_Long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC13a(1l));
+ assertEquals("{x:'10'}", dr.postC13a(10l));
+ try { dr.postC13a(0l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC13a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC13a(null));
+ }
+ @Test
+ public void d13b_Long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC13b(1l));
+ assertEquals("{x:'10'}", dr.postC13b(10l));
+ try { dr.postC13b(0l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC13b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC13b(null));
+ }
+ @Test
+ public void d13c_Long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC13c(2l));
+ assertEquals("{x:'9'}", dr.postC13c(9l));
+ try { dr.postC13c(1l); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC13c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC13c(null));
+ }
+ @Test
+ public void d14a_Float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC14a(1f));
+ assertEquals("{x:'10.0'}", dr.postC14a(10f));
+ try { dr.postC14a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC14a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC14a(null));
+ }
+ @Test
+ public void d14b_Float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC14b(1f));
+ assertEquals("{x:'10.0'}", dr.postC14b(10f));
+ try { dr.postC14b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC14b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC14b(null));
+ }
+ @Test
+ public void d14c_Float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.postC14c(1.1f));
+ assertEquals("{x:'9.9'}", dr.postC14c(9.9f));
+ try { dr.postC14c(1f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC14c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC14c(null));
+ }
+ @Test
+ public void d15a_Double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC15a(1d));
+ assertEquals("{x:'10.0'}", dr.postC15a(10d));
+ try { dr.postC15a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC15a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC15a(null));
+ }
+ @Test
+ public void d15b_Double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.postC15b(1d));
+ assertEquals("{x:'10.0'}", dr.postC15b(10d));
+ try { dr.postC15b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC15b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC15b(null));
+ }
+ @Test
+ public void d15c_Double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.postC15c(1.1d));
+ assertEquals("{x:'9.9'}", dr.postC15c(9.9d));
+ try { dr.postC15c(1d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC15c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC15c(null));
+ }
+ @Test
+ public void d16a_Byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC16a((byte)1));
+ assertEquals("{x:'10'}", dr.postC16a((byte)10));
+ try { dr.postC16a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC16a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC16a(null));
+ }
+ @Test
+ public void d16b_Byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.postC16b((byte)1));
+ assertEquals("{x:'10'}", dr.postC16b((byte)10));
+ try { dr.postC16b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC16b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC16b(null));
+ }
+ @Test
+ public void d16c_Byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.postC16c((byte)2));
+ assertEquals("{x:'9'}", dr.postC16c((byte)9));
+ try { dr.postC16c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.postC16c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.postC16c(null));
+ }
}
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 7443d28..8037a0c 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
@@ -16,7 +16,9 @@ import static org.apache.juneau.testutils.TestUtils.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
+import java.math.*;
import java.util.*;
+import java.util.concurrent.atomic.*;
import org.apache.juneau.*;
import org.apache.juneau.http.annotation.*;
@@ -266,4 +268,379 @@ public class HeaderAnnotationTest {
public void c07a_uon() throws Exception {
assertEquals("{x:'@(foo,bar)'}", cr.getC07("foo","bar"));
}
+
+
//=================================================================================================================
+ // @Header(maximum,exclusiveMaximum,minimum,exclusiveMinimum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class D {
+ @RestMethod
+ public String get(@Header("*") ObjectMap m) {
+
m.removeAll("Accept-Encoding","Connection","Host","User-Agent");
+ return m.toString();
+ }
+ }
+ private static MockRest d = MockRest.create(D.class);
+
+ @RemoteResource
+ public static interface DR {
+ @RemoteMethod(path="/") String
getC01a(@Header(name="x",minimum="1",maximum="10") int b);
+ @RemoteMethod(path="/") String
getC01b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
int b);
+ @RemoteMethod(path="/") String
getC01c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
int b);
+ @RemoteMethod(path="/") String
getC02a(@Header(name="x",minimum="1",maximum="10") short b);
+ @RemoteMethod(path="/") String
getC02b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
short b);
+ @RemoteMethod(path="/") String
getC02c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
short b);
+ @RemoteMethod(path="/") String
getC03a(@Header(name="x",minimum="1",maximum="10") long b);
+ @RemoteMethod(path="/") String
getC03b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
long b);
+ @RemoteMethod(path="/") String
getC03c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
long b);
+ @RemoteMethod(path="/") String
getC04a(@Header(name="x",minimum="1",maximum="10") float b);
+ @RemoteMethod(path="/") String
getC04b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
float b);
+ @RemoteMethod(path="/") String
getC04c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
float b);
+ @RemoteMethod(path="/") String
getC05a(@Header(name="x",minimum="1",maximum="10") double b);
+ @RemoteMethod(path="/") String
getC05b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
double b);
+ @RemoteMethod(path="/") String
getC05c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
double b);
+ @RemoteMethod(path="/") String
getC06a(@Header(name="x",minimum="1",maximum="10") byte b);
+ @RemoteMethod(path="/") String
getC06b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
byte b);
+ @RemoteMethod(path="/") String
getC06c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
byte b);
+ @RemoteMethod(path="/") String
getC07a(@Header(name="x",minimum="1",maximum="10") AtomicInteger b);
+ @RemoteMethod(path="/") String
getC07b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
AtomicInteger b);
+ @RemoteMethod(path="/") String
getC07c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
AtomicInteger b);
+ @RemoteMethod(path="/") String
getC08a(@Header(name="x",minimum="1",maximum="10") BigDecimal b);
+ @RemoteMethod(path="/") String
getC08b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
BigDecimal b);
+ @RemoteMethod(path="/") String
getC08c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
BigDecimal b);
+ @RemoteMethod(path="/") String
getC11a(@Header(name="x",minimum="1",maximum="10") Integer b);
+ @RemoteMethod(path="/") String
getC11b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Integer b);
+ @RemoteMethod(path="/") String
getC11c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Integer b);
+ @RemoteMethod(path="/") String
getC12a(@Header(name="x",minimum="1",maximum="10") Short b);
+ @RemoteMethod(path="/") String
getC12b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Short b);
+ @RemoteMethod(path="/") String
getC12c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Short b);
+ @RemoteMethod(path="/") String
getC13a(@Header(name="x",minimum="1",maximum="10") Long b);
+ @RemoteMethod(path="/") String
getC13b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Long b);
+ @RemoteMethod(path="/") String
getC13c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Long b);
+ @RemoteMethod(path="/") String
getC14a(@Header(name="x",minimum="1",maximum="10") Float b);
+ @RemoteMethod(path="/") String
getC14b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Float b);
+ @RemoteMethod(path="/") String
getC14c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Float b);
+ @RemoteMethod(path="/") String
getC15a(@Header(name="x",minimum="1",maximum="10") Double b);
+ @RemoteMethod(path="/") String
getC15b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Double b);
+ @RemoteMethod(path="/") String
getC15c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Double b);
+ @RemoteMethod(path="/") String
getC16a(@Header(name="x",minimum="1",maximum="10") Byte b);
+ @RemoteMethod(path="/") String
getC16b(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Byte b);
+ @RemoteMethod(path="/") String
getC16c(@Header(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Byte b);
+ }
+
+ private static DR dr =
RestClient.create().mockHttpConnection(d).build().getRemoteResource(DR.class);
+
+ @Test
+ public void d01a_int_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01a(1));
+ assertEquals("{x:'10'}", dr.getC01a(10));
+ try { dr.getC01a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01b_int_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01b(1));
+ assertEquals("{x:'10'}", dr.getC01b(10));
+ try { dr.getC01b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01c_int_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC01c(2));
+ assertEquals("{x:'9'}", dr.getC01c(9));
+ try { dr.getC01c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d02a_short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02a((short)1));
+ assertEquals("{x:'10'}", dr.getC02a((short)10));
+ try { dr.getC02a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02b_short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02b((short)1));
+ assertEquals("{x:'10'}", dr.getC02b((short)10));
+ try { dr.getC02b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02c_short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC02c((short)2));
+ assertEquals("{x:'9'}", dr.getC02c((short)9));
+ try { dr.getC02c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03a_long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03a(1l));
+ assertEquals("{x:'10'}", dr.getC03a(10l));
+ try { dr.getC03a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03b_long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03b(1l));
+ assertEquals("{x:'10'}", dr.getC03b(10l));
+ try { dr.getC03b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03c_long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC03c(2l));
+ assertEquals("{x:'9'}", dr.getC03c(9l));
+ try { dr.getC03c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04a_float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04a(1f));
+ assertEquals("{x:'10.0'}", dr.getC04a(10f));
+ try { dr.getC04a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04b_float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04b(1f));
+ assertEquals("{x:'10.0'}", dr.getC04b(10f));
+ try { dr.getC04b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04c_float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC04c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC04c(9.9f));
+ try { dr.getC04c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC04c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05a_double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05a(1d));
+ assertEquals("{x:'10.0'}", dr.getC05a(10d));
+ try { dr.getC05a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05b_double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05b(1d));
+ assertEquals("{x:'10.0'}", dr.getC05b(10d));
+ try { dr.getC05b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05c_double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC05c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC05c(9.9d));
+ try { dr.getC05c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC05c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06a_byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06a((byte)1));
+ assertEquals("{x:'10'}", dr.getC06a((byte)10));
+ try { dr.getC06a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06b_byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06b((byte)1));
+ assertEquals("{x:'10'}", dr.getC06b((byte)10));
+ try { dr.getC06b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06c_byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC06c((byte)2));
+ assertEquals("{x:'9'}", dr.getC06c((byte)9));
+ try { dr.getC06c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07a_AtomicInteger_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07a(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07a(new AtomicInteger(10)));
+ try { dr.getC07a(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07a(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07b_AtomicInteger_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07b(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07b(new AtomicInteger(10)));
+ try { dr.getC07b(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07b(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07c_AtomicInteger_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC07c(new AtomicInteger(2)));
+ assertEquals("{x:'9'}", dr.getC07c(new AtomicInteger(9)));
+ try { dr.getC07c(new AtomicInteger(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07c(new AtomicInteger(10)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08a_BigDecimal_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08a(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08a(new BigDecimal(10)));
+ try { dr.getC08a(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08a(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08b_BigDecimal_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08b(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08b(new BigDecimal(10)));
+ try { dr.getC08b(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08b(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08cBigDecimal_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC08c(new BigDecimal(2)));
+ assertEquals("{x:'9'}", dr.getC08c(new BigDecimal(9)));
+ try { dr.getC08c(new BigDecimal(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08c(new BigDecimal(10)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d11a_Integer_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11a(1));
+ assertEquals("{x:'10'}", dr.getC11a(10));
+ try { dr.getC11a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11a(null));
+ }
+ @Test
+ public void d11b_Integer_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11b(1));
+ assertEquals("{x:'10'}", dr.getC11b(10));
+ try { dr.getC11b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11b(null));
+ }
+ @Test
+ public void d11c_Integer_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC11c(2));
+ assertEquals("{x:'9'}", dr.getC11c(9));
+ try { dr.getC11c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11c(null));
+ }
+ @Test
+ public void d12a_Short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12a((short)1));
+ assertEquals("{x:'10'}", dr.getC12a((short)10));
+ try { dr.getC12a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12a(null));
+ }
+ @Test
+ public void d12b_Short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12b((short)1));
+ assertEquals("{x:'10'}", dr.getC12b((short)10));
+ try { dr.getC12b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12b(null));
+ }
+ @Test
+ public void d12c_Short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC12c((short)2));
+ assertEquals("{x:'9'}", dr.getC12c((short)9));
+ try { dr.getC12c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12c(null));
+ }
+ @Test
+ public void d13a_Long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13a(1l));
+ assertEquals("{x:'10'}", dr.getC13a(10l));
+ try { dr.getC13a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13a(null));
+ }
+ @Test
+ public void d13b_Long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13b(1l));
+ assertEquals("{x:'10'}", dr.getC13b(10l));
+ try { dr.getC13b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13b(null));
+ }
+ @Test
+ public void d13c_Long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC13c(2l));
+ assertEquals("{x:'9'}", dr.getC13c(9l));
+ try { dr.getC13c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13c(null));
+ }
+ @Test
+ public void d14a_Float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14a(1f));
+ assertEquals("{x:'10.0'}", dr.getC14a(10f));
+ try { dr.getC14a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14a(null));
+ }
+ @Test
+ public void d14b_Float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14b(1f));
+ assertEquals("{x:'10.0'}", dr.getC14b(10f));
+ try { dr.getC14b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14b(null));
+ }
+ @Test
+ public void d14c_Float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC14c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC14c(9.9f));
+ try { dr.getC14c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC14c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14c(null));
+ }
+ @Test
+ public void d15a_Double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15a(1d));
+ assertEquals("{x:'10.0'}", dr.getC15a(10d));
+ try { dr.getC15a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15a(null));
+ }
+ @Test
+ public void d15b_Double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15b(1d));
+ assertEquals("{x:'10.0'}", dr.getC15b(10d));
+ try { dr.getC15b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15b(null));
+ }
+ @Test
+ public void d15c_Double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC15c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC15c(9.9d));
+ try { dr.getC15c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC15c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15c(null));
+ }
+ @Test
+ public void d16a_Byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16a((byte)1));
+ assertEquals("{x:'10'}", dr.getC16a((byte)10));
+ try { dr.getC16a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16a(null));
+ }
+ @Test
+ public void d16b_Byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16b((byte)1));
+ assertEquals("{x:'10'}", dr.getC16b((byte)10));
+ try { dr.getC16b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16b(null));
+ }
+ @Test
+ public void d16c_Byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC16c((byte)2));
+ assertEquals("{x:'9'}", dr.getC16c((byte)9));
+ try { dr.getC16c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16c(null));
+ }
}
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 d90b5f3..eed34f9 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
@@ -12,11 +12,15 @@
//
***************************************************************************************************************************
package org.apache.juneau.rest.client.remote;
+import static org.apache.juneau.testutils.TestUtils.*;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
+import java.math.*;
import java.util.*;
+import java.util.concurrent.atomic.*;
+import org.apache.juneau.*;
import org.apache.juneau.http.annotation.*;
import org.apache.juneau.rest.annotation.*;
import org.apache.juneau.rest.client.*;
@@ -198,4 +202,379 @@ public class PathAnnotationTest {
public void c07a_uon() throws Exception {
assertEquals("@(foo,bar)", cr.getC07("foo","bar"));
}
+
+
//=================================================================================================================
+ // @Path(maximum,exclusiveMaximum,minimum,exclusiveMinimum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class D {
+ @RestMethod(path="/a/{x}")
+ public String get(@Path("*") ObjectMap m) {
+ m.removeAll("/*","/**");
+ return m.toString();
+ }
+ }
+ private static MockRest d = MockRest.create(D.class);
+
+ @RemoteResource
+ public static interface DR {
+ @RemoteMethod(path="/a/{x}") String
getC01a(@Path(name="x",minimum="1",maximum="10") int b);
+ @RemoteMethod(path="/a/{x}") String
getC01b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
int b);
+ @RemoteMethod(path="/a/{x}") String
getC01c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
int b);
+ @RemoteMethod(path="/a/{x}") String
getC02a(@Path(name="x",minimum="1",maximum="10") short b);
+ @RemoteMethod(path="/a/{x}") String
getC02b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
short b);
+ @RemoteMethod(path="/a/{x}") String
getC02c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
short b);
+ @RemoteMethod(path="/a/{x}") String
getC03a(@Path(name="x",minimum="1",maximum="10") long b);
+ @RemoteMethod(path="/a/{x}") String
getC03b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
long b);
+ @RemoteMethod(path="/a/{x}") String
getC03c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
long b);
+ @RemoteMethod(path="/a/{x}") String
getC04a(@Path(name="x",minimum="1",maximum="10") float b);
+ @RemoteMethod(path="/a/{x}") String
getC04b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
float b);
+ @RemoteMethod(path="/a/{x}") String
getC04c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
float b);
+ @RemoteMethod(path="/a/{x}") String
getC05a(@Path(name="x",minimum="1",maximum="10") double b);
+ @RemoteMethod(path="/a/{x}") String
getC05b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
double b);
+ @RemoteMethod(path="/a/{x}") String
getC05c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
double b);
+ @RemoteMethod(path="/a/{x}") String
getC06a(@Path(name="x",minimum="1",maximum="10") byte b);
+ @RemoteMethod(path="/a/{x}") String
getC06b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
byte b);
+ @RemoteMethod(path="/a/{x}") String
getC06c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
byte b);
+ @RemoteMethod(path="/a/{x}") String
getC07a(@Path(name="x",minimum="1",maximum="10") AtomicInteger b);
+ @RemoteMethod(path="/a/{x}") String
getC07b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
AtomicInteger b);
+ @RemoteMethod(path="/a/{x}") String
getC07c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
AtomicInteger b);
+ @RemoteMethod(path="/a/{x}") String
getC08a(@Path(name="x",minimum="1",maximum="10") BigDecimal b);
+ @RemoteMethod(path="/a/{x}") String
getC08b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
BigDecimal b);
+ @RemoteMethod(path="/a/{x}") String
getC08c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
BigDecimal b);
+ @RemoteMethod(path="/a/{x}") String
getC11a(@Path(name="x",minimum="1",maximum="10") Integer b);
+ @RemoteMethod(path="/a/{x}") String
getC11b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Integer b);
+ @RemoteMethod(path="/a/{x}") String
getC11c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Integer b);
+ @RemoteMethod(path="/a/{x}") String
getC12a(@Path(name="x",minimum="1",maximum="10") Short b);
+ @RemoteMethod(path="/a/{x}") String
getC12b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Short b);
+ @RemoteMethod(path="/a/{x}") String
getC12c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Short b);
+ @RemoteMethod(path="/a/{x}") String
getC13a(@Path(name="x",minimum="1",maximum="10") Long b);
+ @RemoteMethod(path="/a/{x}") String
getC13b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Long b);
+ @RemoteMethod(path="/a/{x}") String
getC13c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Long b);
+ @RemoteMethod(path="/a/{x}") String
getC14a(@Path(name="x",minimum="1",maximum="10") Float b);
+ @RemoteMethod(path="/a/{x}") String
getC14b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Float b);
+ @RemoteMethod(path="/a/{x}") String
getC14c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Float b);
+ @RemoteMethod(path="/a/{x}") String
getC15a(@Path(name="x",minimum="1",maximum="10") Double b);
+ @RemoteMethod(path="/a/{x}") String
getC15b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Double b);
+ @RemoteMethod(path="/a/{x}") String
getC15c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Double b);
+ @RemoteMethod(path="/a/{x}") String
getC16a(@Path(name="x",minimum="1",maximum="10") Byte b);
+ @RemoteMethod(path="/a/{x}") String
getC16b(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Byte b);
+ @RemoteMethod(path="/a/{x}") String
getC16c(@Path(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Byte b);
+ }
+
+ private static DR dr =
RestClient.create().mockHttpConnection(d).build().getRemoteResource(DR.class);
+
+ @Test
+ public void d01a_int_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01a(1));
+ assertEquals("{x:'10'}", dr.getC01a(10));
+ try { dr.getC01a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01b_int_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01b(1));
+ assertEquals("{x:'10'}", dr.getC01b(10));
+ try { dr.getC01b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01c_int_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC01c(2));
+ assertEquals("{x:'9'}", dr.getC01c(9));
+ try { dr.getC01c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d02a_short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02a((short)1));
+ assertEquals("{x:'10'}", dr.getC02a((short)10));
+ try { dr.getC02a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02b_short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02b((short)1));
+ assertEquals("{x:'10'}", dr.getC02b((short)10));
+ try { dr.getC02b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02c_short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC02c((short)2));
+ assertEquals("{x:'9'}", dr.getC02c((short)9));
+ try { dr.getC02c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03a_long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03a(1l));
+ assertEquals("{x:'10'}", dr.getC03a(10l));
+ try { dr.getC03a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03b_long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03b(1l));
+ assertEquals("{x:'10'}", dr.getC03b(10l));
+ try { dr.getC03b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03c_long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC03c(2l));
+ assertEquals("{x:'9'}", dr.getC03c(9l));
+ try { dr.getC03c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04a_float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04a(1f));
+ assertEquals("{x:'10.0'}", dr.getC04a(10f));
+ try { dr.getC04a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04b_float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04b(1f));
+ assertEquals("{x:'10.0'}", dr.getC04b(10f));
+ try { dr.getC04b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04c_float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC04c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC04c(9.9f));
+ try { dr.getC04c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC04c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05a_double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05a(1d));
+ assertEquals("{x:'10.0'}", dr.getC05a(10d));
+ try { dr.getC05a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05b_double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05b(1d));
+ assertEquals("{x:'10.0'}", dr.getC05b(10d));
+ try { dr.getC05b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05c_double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC05c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC05c(9.9d));
+ try { dr.getC05c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC05c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06a_byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06a((byte)1));
+ assertEquals("{x:'10'}", dr.getC06a((byte)10));
+ try { dr.getC06a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06b_byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06b((byte)1));
+ assertEquals("{x:'10'}", dr.getC06b((byte)10));
+ try { dr.getC06b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06c_byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC06c((byte)2));
+ assertEquals("{x:'9'}", dr.getC06c((byte)9));
+ try { dr.getC06c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07a_AtomicInteger_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07a(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07a(new AtomicInteger(10)));
+ try { dr.getC07a(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07a(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07b_AtomicInteger_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07b(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07b(new AtomicInteger(10)));
+ try { dr.getC07b(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07b(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07c_AtomicInteger_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC07c(new AtomicInteger(2)));
+ assertEquals("{x:'9'}", dr.getC07c(new AtomicInteger(9)));
+ try { dr.getC07c(new AtomicInteger(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07c(new AtomicInteger(10)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08a_BigDecimal_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08a(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08a(new BigDecimal(10)));
+ try { dr.getC08a(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08a(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08b_BigDecimal_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08b(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08b(new BigDecimal(10)));
+ try { dr.getC08b(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08b(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08cBigDecimal_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC08c(new BigDecimal(2)));
+ assertEquals("{x:'9'}", dr.getC08c(new BigDecimal(9)));
+ try { dr.getC08c(new BigDecimal(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08c(new BigDecimal(10)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d11a_Integer_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11a(1));
+ assertEquals("{x:'10'}", dr.getC11a(10));
+ try { dr.getC11a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC11a(null));
+ }
+ @Test
+ public void d11b_Integer_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11b(1));
+ assertEquals("{x:'10'}", dr.getC11b(10));
+ try { dr.getC11b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC11b(null));
+ }
+ @Test
+ public void d11c_Integer_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC11c(2));
+ assertEquals("{x:'9'}", dr.getC11c(9));
+ try { dr.getC11c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC11c(null));
+ }
+ @Test
+ public void d12a_Short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12a((short)1));
+ assertEquals("{x:'10'}", dr.getC12a((short)10));
+ try { dr.getC12a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC12a(null));
+ }
+ @Test
+ public void d12b_Short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12b((short)1));
+ assertEquals("{x:'10'}", dr.getC12b((short)10));
+ try { dr.getC12b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC12b(null));
+ }
+ @Test
+ public void d12c_Short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC12c((short)2));
+ assertEquals("{x:'9'}", dr.getC12c((short)9));
+ try { dr.getC12c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC12c(null));
+ }
+ @Test
+ public void d13a_Long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13a(1l));
+ assertEquals("{x:'10'}", dr.getC13a(10l));
+ try { dr.getC13a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC13a(null));
+ }
+ @Test
+ public void d13b_Long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13b(1l));
+ assertEquals("{x:'10'}", dr.getC13b(10l));
+ try { dr.getC13b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC13b(null));
+ }
+ @Test
+ public void d13c_Long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC13c(2l));
+ assertEquals("{x:'9'}", dr.getC13c(9l));
+ try { dr.getC13c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC13c(null));
+ }
+ @Test
+ public void d14a_Float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14a(1f));
+ assertEquals("{x:'10.0'}", dr.getC14a(10f));
+ try { dr.getC14a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC14a(null));
+ }
+ @Test
+ public void d14b_Float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14b(1f));
+ assertEquals("{x:'10.0'}", dr.getC14b(10f));
+ try { dr.getC14b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC14b(null));
+ }
+ @Test
+ public void d14c_Float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC14c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC14c(9.9f));
+ try { dr.getC14c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC14c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC14c(null));
+ }
+ @Test
+ public void d15a_Double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15a(1d));
+ assertEquals("{x:'10.0'}", dr.getC15a(10d));
+ try { dr.getC15a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC15a(null));
+ }
+ @Test
+ public void d15b_Double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15b(1d));
+ assertEquals("{x:'10.0'}", dr.getC15b(10d));
+ try { dr.getC15b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC15b(null));
+ }
+ @Test
+ public void d15c_Double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC15c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC15c(9.9d));
+ try { dr.getC15c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC15c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC15c(null));
+ }
+ @Test
+ public void d16a_Byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16a((byte)1));
+ assertEquals("{x:'10'}", dr.getC16a((byte)10));
+ try { dr.getC16a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC16a(null));
+ }
+ @Test
+ public void d16b_Byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16b((byte)1));
+ assertEquals("{x:'10'}", dr.getC16b((byte)10));
+ try { dr.getC16b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC16b(null));
+ }
+ @Test
+ public void d16c_Byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC16c((byte)2));
+ assertEquals("{x:'9'}", dr.getC16c((byte)9));
+ try { dr.getC16c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{x:'null'}", dr.getC16c(null));
+ }
}
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 1700e66..0c929c9 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
@@ -17,7 +17,9 @@ import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.io.*;
+import java.math.*;
import java.util.*;
+import java.util.concurrent.atomic.*;
import org.apache.juneau.*;
import org.apache.juneau.http.annotation.*;
@@ -325,4 +327,378 @@ public class QueryAnnotationTest {
public void c07b_uon_raw() throws Exception {
assertEquals("x=%40%28foo%2Cbar%29", cr.getC07b("foo","bar"));
}
+
+
//=================================================================================================================
+ // @Query(maximum,exclusiveMaximum,minimum,exclusiveMinimum)
+
//=================================================================================================================
+
+ @RestResource
+ public static class D {
+ @RestMethod
+ public String get(@Query("*") ObjectMap m) {
+ return m.toString();
+ }
+ }
+ private static MockRest d = MockRest.create(D.class);
+
+ @RemoteResource
+ public static interface DR {
+ @RemoteMethod(path="/") String
getC01a(@Query(name="x",minimum="1",maximum="10") int b);
+ @RemoteMethod(path="/") String
getC01b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
int b);
+ @RemoteMethod(path="/") String
getC01c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
int b);
+ @RemoteMethod(path="/") String
getC02a(@Query(name="x",minimum="1",maximum="10") short b);
+ @RemoteMethod(path="/") String
getC02b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
short b);
+ @RemoteMethod(path="/") String
getC02c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
short b);
+ @RemoteMethod(path="/") String
getC03a(@Query(name="x",minimum="1",maximum="10") long b);
+ @RemoteMethod(path="/") String
getC03b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
long b);
+ @RemoteMethod(path="/") String
getC03c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
long b);
+ @RemoteMethod(path="/") String
getC04a(@Query(name="x",minimum="1",maximum="10") float b);
+ @RemoteMethod(path="/") String
getC04b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
float b);
+ @RemoteMethod(path="/") String
getC04c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
float b);
+ @RemoteMethod(path="/") String
getC05a(@Query(name="x",minimum="1",maximum="10") double b);
+ @RemoteMethod(path="/") String
getC05b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
double b);
+ @RemoteMethod(path="/") String
getC05c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
double b);
+ @RemoteMethod(path="/") String
getC06a(@Query(name="x",minimum="1",maximum="10") byte b);
+ @RemoteMethod(path="/") String
getC06b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
byte b);
+ @RemoteMethod(path="/") String
getC06c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
byte b);
+ @RemoteMethod(path="/") String
getC07a(@Query(name="x",minimum="1",maximum="10") AtomicInteger b);
+ @RemoteMethod(path="/") String
getC07b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
AtomicInteger b);
+ @RemoteMethod(path="/") String
getC07c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
AtomicInteger b);
+ @RemoteMethod(path="/") String
getC08a(@Query(name="x",minimum="1",maximum="10") BigDecimal b);
+ @RemoteMethod(path="/") String
getC08b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
BigDecimal b);
+ @RemoteMethod(path="/") String
getC08c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
BigDecimal b);
+ @RemoteMethod(path="/") String
getC11a(@Query(name="x",minimum="1",maximum="10") Integer b);
+ @RemoteMethod(path="/") String
getC11b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Integer b);
+ @RemoteMethod(path="/") String
getC11c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Integer b);
+ @RemoteMethod(path="/") String
getC12a(@Query(name="x",minimum="1",maximum="10") Short b);
+ @RemoteMethod(path="/") String
getC12b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Short b);
+ @RemoteMethod(path="/") String
getC12c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Short b);
+ @RemoteMethod(path="/") String
getC13a(@Query(name="x",minimum="1",maximum="10") Long b);
+ @RemoteMethod(path="/") String
getC13b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Long b);
+ @RemoteMethod(path="/") String
getC13c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Long b);
+ @RemoteMethod(path="/") String
getC14a(@Query(name="x",minimum="1",maximum="10") Float b);
+ @RemoteMethod(path="/") String
getC14b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Float b);
+ @RemoteMethod(path="/") String
getC14c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Float b);
+ @RemoteMethod(path="/") String
getC15a(@Query(name="x",minimum="1",maximum="10") Double b);
+ @RemoteMethod(path="/") String
getC15b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Double b);
+ @RemoteMethod(path="/") String
getC15c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Double b);
+ @RemoteMethod(path="/") String
getC16a(@Query(name="x",minimum="1",maximum="10") Byte b);
+ @RemoteMethod(path="/") String
getC16b(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=false,exclusiveMaximum=false)
Byte b);
+ @RemoteMethod(path="/") String
getC16c(@Query(name="x",minimum="1",maximum="10",exclusiveMinimum=true,exclusiveMaximum=true)
Byte b);
+ }
+
+ private static DR dr =
RestClient.create().mockHttpConnection(d).build().getRemoteResource(DR.class);
+
+ @Test
+ public void d01a_int_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01a(1));
+ assertEquals("{x:'10'}", dr.getC01a(10));
+ try { dr.getC01a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01b_int_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC01b(1));
+ assertEquals("{x:'10'}", dr.getC01b(10));
+ try { dr.getC01b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d01c_int_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC01c(2));
+ assertEquals("{x:'9'}", dr.getC01c(9));
+ try { dr.getC01c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC01c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ }
+ @Test
+ public void d02a_short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02a((short)1));
+ assertEquals("{x:'10'}", dr.getC02a((short)10));
+ try { dr.getC02a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02b_short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC02b((short)1));
+ assertEquals("{x:'10'}", dr.getC02b((short)10));
+ try { dr.getC02b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d02c_short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC02c((short)2));
+ assertEquals("{x:'9'}", dr.getC02c((short)9));
+ try { dr.getC02c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC02c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03a_long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03a(1l));
+ assertEquals("{x:'10'}", dr.getC03a(10l));
+ try { dr.getC03a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03b_long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC03b(1l));
+ assertEquals("{x:'10'}", dr.getC03b(10l));
+ try { dr.getC03b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d03c_long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC03c(2l));
+ assertEquals("{x:'9'}", dr.getC03c(9l));
+ try { dr.getC03c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC03c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04a_float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04a(1f));
+ assertEquals("{x:'10.0'}", dr.getC04a(10f));
+ try { dr.getC04a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04b_float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC04b(1f));
+ assertEquals("{x:'10.0'}", dr.getC04b(10f));
+ try { dr.getC04b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC04b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d04c_float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC04c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC04c(9.9f));
+ try { dr.getC04c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC04c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05a_double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05a(1d));
+ assertEquals("{x:'10.0'}", dr.getC05a(10d));
+ try { dr.getC05a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05b_double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC05b(1d));
+ assertEquals("{x:'10.0'}", dr.getC05b(10d));
+ try { dr.getC05b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC05b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d05c_double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC05c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC05c(9.9d));
+ try { dr.getC05c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC05c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06a_byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06a((byte)1));
+ assertEquals("{x:'10'}", dr.getC06a((byte)10));
+ try { dr.getC06a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06b_byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC06b((byte)1));
+ assertEquals("{x:'10'}", dr.getC06b((byte)10));
+ try { dr.getC06b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d06c_byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC06c((byte)2));
+ assertEquals("{x:'9'}", dr.getC06c((byte)9));
+ try { dr.getC06c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC06c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07a_AtomicInteger_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07a(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07a(new AtomicInteger(10)));
+ try { dr.getC07a(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07a(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07b_AtomicInteger_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC07b(new AtomicInteger(1)));
+ assertEquals("{x:'10'}", dr.getC07b(new AtomicInteger(10)));
+ try { dr.getC07b(new AtomicInteger(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07b(new AtomicInteger(11)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d07c_AtomicInteger_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC07c(new AtomicInteger(2)));
+ assertEquals("{x:'9'}", dr.getC07c(new AtomicInteger(9)));
+ try { dr.getC07c(new AtomicInteger(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC07c(new AtomicInteger(10)); } catch (Exception e)
{ assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08a_BigDecimal_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08a(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08a(new BigDecimal(10)));
+ try { dr.getC08a(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08a(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08b_BigDecimal_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC08b(new BigDecimal(1)));
+ assertEquals("{x:'10'}", dr.getC08b(new BigDecimal(10)));
+ try { dr.getC08b(new BigDecimal(0)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08b(new BigDecimal(11)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d08cBigDecimal_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC08c(new BigDecimal(2)));
+ assertEquals("{x:'9'}", dr.getC08c(new BigDecimal(9)));
+ try { dr.getC08c(new BigDecimal(1)); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC08c(new BigDecimal(10)); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ }
+ @Test
+ public void d11a_Integer_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11a(1));
+ assertEquals("{x:'10'}", dr.getC11a(10));
+ try { dr.getC11a(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11a(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11a(null));
+ }
+ @Test
+ public void d11b_Integer_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC11b(1));
+ assertEquals("{x:'10'}", dr.getC11b(10));
+ try { dr.getC11b(0); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11b(11); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11b(null));
+ }
+ @Test
+ public void d11c_Integer_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC11c(2));
+ assertEquals("{x:'9'}", dr.getC11c(9));
+ try { dr.getC11c(1); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC11c(10); } catch (Exception e) { assertContains(e,
"Maximum value exceeded"); }
+ assertEquals("{}", dr.getC11c(null));
+ }
+ @Test
+ public void d12a_Short_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12a((short)1));
+ assertEquals("{x:'10'}", dr.getC12a((short)10));
+ try { dr.getC12a((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12a((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12a(null));
+ }
+ @Test
+ public void d12b_Short_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC12b((short)1));
+ assertEquals("{x:'10'}", dr.getC12b((short)10));
+ try { dr.getC12b((short)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12b((short)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12b(null));
+ }
+ @Test
+ public void d12c_Short_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC12c((short)2));
+ assertEquals("{x:'9'}", dr.getC12c((short)9));
+ try { dr.getC12c((short)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC12c((short)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC12c(null));
+ }
+ @Test
+ public void d13a_Long_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13a(1l));
+ assertEquals("{x:'10'}", dr.getC13a(10l));
+ try { dr.getC13a(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13a(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13a(null));
+ }
+ @Test
+ public void d13b_Long_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC13b(1l));
+ assertEquals("{x:'10'}", dr.getC13b(10l));
+ try { dr.getC13b(0l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13b(11l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13b(null));
+ }
+ @Test
+ public void d13c_Long_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC13c(2l));
+ assertEquals("{x:'9'}", dr.getC13c(9l));
+ try { dr.getC13c(1l); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC13c(10l); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC13c(null));
+ }
+ @Test
+ public void d14a_Float_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14a(1f));
+ assertEquals("{x:'10.0'}", dr.getC14a(10f));
+ try { dr.getC14a(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14a(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14a(null));
+ }
+ @Test
+ public void d14b_Float_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC14b(1f));
+ assertEquals("{x:'10.0'}", dr.getC14b(10f));
+ try { dr.getC14b(0.9f); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC14b(10.1f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14b(null));
+ }
+ @Test
+ public void d14c_Float_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC14c(1.1f));
+ assertEquals("{x:'9.9'}", dr.getC14c(9.9f));
+ try { dr.getC14c(1f); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC14c(10f); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC14c(null));
+ }
+ @Test
+ public void d15a_Double_defaultExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15a(1d));
+ assertEquals("{x:'10.0'}", dr.getC15a(10d));
+ try { dr.getC15a(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15a(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15a(null));
+ }
+ @Test
+ public void d15b_Double_notExclusive() throws Exception {
+ assertEquals("{x:'1.0'}", dr.getC15b(1d));
+ assertEquals("{x:'10.0'}", dr.getC15b(10d));
+ try { dr.getC15b(0.9d); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC15b(10.1d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15b(null));
+ }
+ @Test
+ public void d15c_Double_exclusive() throws Exception {
+ assertEquals("{x:'1.1'}", dr.getC15c(1.1d));
+ assertEquals("{x:'9.9'}", dr.getC15c(9.9d));
+ try { dr.getC15c(1d); } catch (Exception e) { assertContains(e,
"Minimum value not met"); }
+ try { dr.getC15c(10d); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC15c(null));
+ }
+ @Test
+ public void d16a_Byte_defaultExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16a((byte)1));
+ assertEquals("{x:'10'}", dr.getC16a((byte)10));
+ try { dr.getC16a((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16a((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16a(null));
+ }
+ @Test
+ public void d16b_Byte_notExclusive() throws Exception {
+ assertEquals("{x:'1'}", dr.getC16b((byte)1));
+ assertEquals("{x:'10'}", dr.getC16b((byte)10));
+ try { dr.getC16b((byte)0); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16b((byte)11); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16b(null));
+ }
+ @Test
+ public void d16c_Byte_exclusive() throws Exception {
+ assertEquals("{x:'2'}", dr.getC16c((byte)2));
+ assertEquals("{x:'9'}", dr.getC16c((byte)9));
+ try { dr.getC16c((byte)1); } catch (Exception e) {
assertContains(e, "Minimum value not met"); }
+ try { dr.getC16c((byte)10); } catch (Exception e) {
assertContains(e, "Maximum value exceeded"); }
+ assertEquals("{}", dr.getC16c(null));
+ }
}