/** * Factory method for getting an instance of JSON numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
/** * Factory method for getting an instance of Json numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
/** * Factory method for getting an instance of JSON numeric value * that expresses given unlimited precision floating point value */ public NumericNode numberNode(BigDecimal v) { return DecimalNode.valueOf(v); }
@Test public void whenReprIsBigDecimal() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, mockEncodableFacet); allowingObjectSpecCorrespondingClassAndSpecIdIs(BigDecimal.class); final BigDecimal value = new BigDecimal("123234234.45612312343535"); representation = new JsonRepresentation(DecimalNode.valueOf(value)); context.checking(new Expectations() { { oneOf(mockAdapterManager).adapterFor(value); will(returnValue(mockObjectAdapter)); } }); // when final ObjectAdapter adapter = JsonValueEncoder.asAdapter(mockObjectSpec, representation, null); // then assertSame(mockObjectAdapter, adapter); }
@Test public void whenReprIsBigDecimal() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, encodableFacet); allowingObjectSpecCorrespondingClassIs(BigDecimal.class); final BigDecimal value = new BigDecimal("123234234.45612312343535"); representation = new JsonRepresentation(DecimalNode.valueOf(value)); context.checking(new Expectations() { { one(encodableFacet).fromEncodedString("" + value); will(returnValue(objectAdapter)); } }); // when final ObjectAdapter adapter = jsonValueEncoder.asAdapter(objectSpec, representation); // then assertSame(objectAdapter, adapter); }
@Test public void whenReprIsBigDecimal() throws Exception { // given allowingObjectSpecHas(EncodableFacet.class, encodableFacet); allowingObjectSpecCorrespondingClassIs(BigDecimal.class); final BigDecimal value = new BigDecimal("123234234.45612312343535"); representation = new JsonRepresentation(DecimalNode.valueOf(value)); context.checking(new Expectations() { { one(encodableFacet).fromEncodedString("" + value); will(returnValue(objectAdapter)); } }); // when final ObjectAdapter adapter = jsonValueEncoder.asAdapter(objectSpec, representation); // then assertSame(objectAdapter, adapter); }