@Test(expected = IllegalArgumentException.class) public void whenObjectSpecIsDoubleButReprIsNot() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); allowingObjectSpecCorrespondingClassAndSpecIdIs(double.class); representation = JsonRepresentation.newMap("foo", "bar"); // when JsonValueEncoder.asAdapter(mockObjectSpec, representation, null); }
@Test public void whenReprIsBooleanWrapper() throws Exception { whenReprIsBoolean(Boolean.class); }
@Test public void whenReprIsDoubleWrapper() throws Exception { whenReprIsDouble(Double.class); }
@Test(expected = IllegalArgumentException.class) public void whenSpecDoesNotHaveAnEncodableFacet() throws Exception { allowingObjectSpecHas(EncodableFacet.class, null); assertNull(JsonValueEncoder.asAdapter(mockObjectSpec, representation, null)); }
@Test public void whenReprIsIntegerWrapper() throws Exception { whenReprIsInteger(Integer.class); }
@Test public void whenReprIsLongWrapper() throws Exception { whenReprIsLong(Long.class); }
@Test(expected = IllegalArgumentException.class) public void whenSpecDoesNotHaveAnEncodableFacet() throws Exception { allowingObjectSpecHas(EncodableFacet.class, null); assertNull(JsonValueEncoder.asAdapter(mockObjectSpec, representation, null)); }
@Test public void whenReprIsIntegerPrimitive() throws Exception { whenReprIsInteger(int.class); }
@Test public void whenReprIsLongPrimitive() throws Exception { whenReprIsLong(long.class); }
@Test(expected = IllegalArgumentException.class) public void whenObjectSpecIsBigDecimalButReprIsNot() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); allowingObjectSpecCorrespondingClassAndSpecIdIs(BigDecimal.class); representation = JsonRepresentation.newMap("foo", "bar"); // when JsonValueEncoder.asAdapter(mockObjectSpec, representation, null); }
@Test(expected = IllegalArgumentException.class) public void whenReprIsAnArray() throws Exception { allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); JsonValueEncoder.asAdapter(mockObjectSpec, JsonRepresentation.newArray(), null); }
@Test public void whenReprIsBooleanPrimitive() throws Exception { whenReprIsBoolean(boolean.class); }
@Test public void whenReprIsIntegerPrimitive() throws Exception { whenReprIsInteger(int.class); }
@Test public void whenReprIsLongWrapper() throws Exception { whenReprIsLong(Long.class); }
@Test public void whenReprIsDoublePrimitive() throws Exception { whenReprIsDouble(double.class); }
@Test(expected = IllegalArgumentException.class) public void whenObjectSpecIsIntegerButReprIsNot() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); allowingObjectSpecCorrespondingClassAndSpecIdIs(int.class); representation = JsonRepresentation.newMap("foo", "bar"); // when JsonValueEncoder.asAdapter(mockObjectSpec, representation, null); }
@Test(expected = IllegalArgumentException.class) public void whenReprIsAnArray() throws Exception { allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); JsonValueEncoder.asAdapter(mockObjectSpec, JsonRepresentation.newArray(), null); }
@Test public void whenReprIsBooleanPrimitive() throws Exception { whenReprIsBoolean(boolean.class); }
@Test public void whenReprIsIntegerWrapper() throws Exception { whenReprIsInteger(Integer.class); }
@Test public void whenReprIsLongPrimitive() throws Exception { whenReprIsLong(long.class); }