Example usage for java.math BigDecimal TEN

List of usage examples for java.math BigDecimal TEN

Introduction

In this page you can find the example usage for java.math BigDecimal TEN.

Prototype

BigDecimal TEN

To view the source code for java.math BigDecimal TEN.

Click Source Link

Document

The value 10, with a scale of 0.

Usage

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListOnlyNoTaxInfo() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/*  ww  w  .j a v  a 2  s .com*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getSalePrice();
            will(returnValue(null));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(false));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("100.00", modelPrice.getRegularPrice().toPlainString());
    assertNull(modelPrice.getSalePrice());

    assertFalse(modelPrice.isTaxInfoEnabled());
    assertFalse(modelPrice.isTaxInfoUseNet());
    assertFalse(modelPrice.isTaxInfoShowAmount());

    assertNull(modelPrice.getPriceTaxCode());
    assertNull(modelPrice.getPriceTaxRate());
    assertFalse(modelPrice.isPriceTaxExclusive());
    assertNull(modelPrice.getPriceTax());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("1000.00", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertFalse(modelTotal.isTaxInfoEnabled());
    assertFalse(modelTotal.isTaxInfoUseNet());
    assertFalse(modelTotal.isTaxInfoShowAmount());

    assertNull(modelTotal.getPriceTaxCode());
    assertNull(modelTotal.getPriceTaxRate());
    assertFalse(modelTotal.isPriceTaxExclusive());
    assertNull(modelTotal.getPriceTax());

    context.assertIsSatisfied();

}

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListAndSaleNoTaxInfo() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/*  ww  w.ja v a  2 s.c  o m*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getSalePrice();
            will(returnValue(new BigDecimal("80.00")));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("80.00")));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(false));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("100.00", modelPrice.getRegularPrice().toPlainString());
    assertEquals("80.00", modelPrice.getSalePrice().toPlainString());

    assertFalse(modelPrice.isTaxInfoEnabled());
    assertFalse(modelPrice.isTaxInfoUseNet());
    assertFalse(modelPrice.isTaxInfoShowAmount());

    assertNull(modelPrice.getPriceTaxCode());
    assertNull(modelPrice.getPriceTaxRate());
    assertFalse(modelPrice.isPriceTaxExclusive());
    assertNull(modelPrice.getPriceTax());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("800.00", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertFalse(modelTotal.isTaxInfoEnabled());
    assertFalse(modelTotal.isTaxInfoUseNet());
    assertFalse(modelTotal.isTaxInfoShowAmount());

    assertNull(modelTotal.getPriceTaxCode());
    assertNull(modelTotal.getPriceTaxRate());
    assertFalse(modelTotal.isPriceTaxExclusive());
    assertNull(modelTotal.getPriceTax());

    context.assertIsSatisfied();

}

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListOnlyWithTaxExclInfoGross() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/*from w w  w . j  a  v a 2s .  c om*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getSalePrice();
            will(returnValue(null));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getNetPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getGrossPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getTaxCode();
            will(returnValue("GROSS"));
            allowing(item).getTaxRate();
            will(returnValue(new BigDecimal("20.00")));
            allowing(item).isTaxExclusiveOfPrice();
            will(returnValue(true));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoUseNet();
            will(returnValue(false));
            allowing(cartCtx).isTaxInfoUseNet();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoShowAmount();
            will(returnValue(true));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("120.00", modelPrice.getRegularPrice().toPlainString());
    assertNull(modelPrice.getSalePrice());

    assertTrue(modelPrice.isTaxInfoEnabled());
    assertFalse(modelPrice.isTaxInfoUseNet());
    assertTrue(modelPrice.isTaxInfoShowAmount());

    assertEquals("GROSS", modelPrice.getPriceTaxCode());
    assertEquals("20.00", modelPrice.getPriceTaxRate().toPlainString());
    assertTrue(modelPrice.isPriceTaxExclusive());
    assertEquals("20.00", modelPrice.getPriceTax().toPlainString());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("1200.00", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertTrue(modelTotal.isTaxInfoEnabled());
    assertFalse(modelTotal.isTaxInfoUseNet());
    assertTrue(modelTotal.isTaxInfoShowAmount());

    assertEquals("GROSS", modelTotal.getPriceTaxCode());
    assertEquals("20.00", modelTotal.getPriceTaxRate().toPlainString());
    assertTrue(modelTotal.isPriceTaxExclusive());
    assertEquals("200.00", modelTotal.getPriceTax().toPlainString());

    context.assertIsSatisfied();

}

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListOnlyWithTaxExclInfoNet() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/* ww w . ja v  a 2 s. c o  m*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getSalePrice();
            will(returnValue(null));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getNetPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getGrossPrice();
            will(returnValue(new BigDecimal("120.00")));
            allowing(item).getTaxCode();
            will(returnValue("GROSS"));
            allowing(item).getTaxRate();
            will(returnValue(new BigDecimal("20.00")));
            allowing(item).isTaxExclusiveOfPrice();
            will(returnValue(true));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoUseNet();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoShowAmount();
            will(returnValue(true));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("100.00", modelPrice.getRegularPrice().toPlainString());
    assertNull(modelPrice.getSalePrice());

    assertTrue(modelPrice.isTaxInfoEnabled());
    assertTrue(modelPrice.isTaxInfoUseNet());
    assertTrue(modelPrice.isTaxInfoShowAmount());

    assertEquals("GROSS", modelPrice.getPriceTaxCode());
    assertEquals("20.00", modelPrice.getPriceTaxRate().toPlainString());
    assertTrue(modelPrice.isPriceTaxExclusive());
    assertEquals("20.00", modelPrice.getPriceTax().toPlainString());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("1000.00", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertTrue(modelTotal.isTaxInfoEnabled());
    assertTrue(modelTotal.isTaxInfoUseNet());
    assertTrue(modelTotal.isTaxInfoShowAmount());

    assertEquals("GROSS", modelTotal.getPriceTaxCode());
    assertEquals("20.00", modelTotal.getPriceTaxRate().toPlainString());
    assertTrue(modelTotal.isPriceTaxExclusive());
    assertEquals("200.00", modelTotal.getPriceTax().toPlainString());

    context.assertIsSatisfied();

}

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListOnlyWithTaxInclInfoGross() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/*from  w  w  w  .j a v a 2  s .co  m*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getSalePrice();
            will(returnValue(null));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getNetPrice();
            will(returnValue(new BigDecimal("83.33")));
            allowing(item).getGrossPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getTaxCode();
            will(returnValue("NET"));
            allowing(item).getTaxRate();
            will(returnValue(new BigDecimal("20.00")));
            allowing(item).isTaxExclusiveOfPrice();
            will(returnValue(false));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoUseNet();
            will(returnValue(false));
            allowing(cartCtx).isTaxInfoShowAmount();
            will(returnValue(true));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("100.00", modelPrice.getRegularPrice().toPlainString());
    assertNull(modelPrice.getSalePrice());

    assertTrue(modelPrice.isTaxInfoEnabled());
    assertFalse(modelPrice.isTaxInfoUseNet());
    assertTrue(modelPrice.isTaxInfoShowAmount());

    assertEquals("NET", modelPrice.getPriceTaxCode());
    assertEquals("20.00", modelPrice.getPriceTaxRate().toPlainString());
    assertFalse(modelPrice.isPriceTaxExclusive());
    assertEquals("16.67", modelPrice.getPriceTax().toPlainString());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("1000.00", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertTrue(modelTotal.isTaxInfoEnabled());
    assertFalse(modelTotal.isTaxInfoUseNet());
    assertTrue(modelTotal.isTaxInfoShowAmount());

    assertEquals("NET", modelTotal.getPriceTaxCode());
    assertEquals("20.00", modelTotal.getPriceTaxRate().toPlainString());
    assertFalse(modelTotal.isPriceTaxExclusive());
    assertEquals("166.70", modelTotal.getPriceTax().toPlainString());

    context.assertIsSatisfied();

}

From source file:org.yes.cart.web.support.service.impl.ProductServiceFacadeImplTest.java

@Test
public void testGetSkuPriceCartItemsPriceListOnlyWithTaxInclInfoNet() throws Exception {

    final ShopService shopService = context.mock(ShopService.class, "shopService");

    final ShoppingCart cart = context.mock(ShoppingCart.class, "cart");
    final ShoppingContext cartCtx = context.mock(ShoppingContext.class, "cartCtx");

    final Shop shop = context.mock(Shop.class, "shop");

    final CartItem item = context.mock(CartItem.class, "item");

    context.checking(new Expectations() {
        {/*from  ww w  .  ja v a2s. c o  m*/
            allowing(cart).getShoppingContext();
            will(returnValue(cartCtx));
            allowing(cartCtx).getShopId();
            will(returnValue(234L));
            allowing(cart).getCurrencyCode();
            will(returnValue("EUR"));
            allowing(item).getProductSkuCode();
            will(returnValue("ABC"));
            allowing(item).getQty();
            will(returnValue(BigDecimal.TEN));
            allowing(item).getListPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getSalePrice();
            will(returnValue(null));
            allowing(item).getPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getNetPrice();
            will(returnValue(new BigDecimal("83.33")));
            allowing(item).getGrossPrice();
            will(returnValue(new BigDecimal("100.00")));
            allowing(item).getTaxCode();
            will(returnValue("NET"));
            allowing(item).getTaxRate();
            will(returnValue(new BigDecimal("20.00")));
            allowing(item).isTaxExclusiveOfPrice();
            will(returnValue(false));
            allowing(shopService).getById(234L);
            will(returnValue(shop));
            allowing(cartCtx).isTaxInfoEnabled();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoUseNet();
            will(returnValue(true));
            allowing(cartCtx).isTaxInfoShowAmount();
            will(returnValue(true));
        }
    });

    final ProductServiceFacade facade = new ProductServiceFacadeImpl(null, null, null, null, null, null, null,
            null, null, null, null, shopService, null);

    final ProductPriceModel modelPrice = facade.getSkuPrice(cart, item, false);

    assertNotNull(modelPrice);

    assertEquals("ABC", modelPrice.getRef());

    assertEquals("EUR", modelPrice.getCurrency());
    assertEquals("10", modelPrice.getQuantity().toPlainString());

    assertEquals("83.33", modelPrice.getRegularPrice().toPlainString());
    assertNull(modelPrice.getSalePrice());

    assertTrue(modelPrice.isTaxInfoEnabled());
    assertTrue(modelPrice.isTaxInfoUseNet());
    assertTrue(modelPrice.isTaxInfoShowAmount());

    assertEquals("NET", modelPrice.getPriceTaxCode());
    assertEquals("20.00", modelPrice.getPriceTaxRate().toPlainString());
    assertFalse(modelPrice.isPriceTaxExclusive());
    assertEquals("16.67", modelPrice.getPriceTax().toPlainString());

    final ProductPriceModel modelTotal = facade.getSkuPrice(cart, item, true);

    assertNotNull(modelTotal);

    assertEquals("ABC", modelTotal.getRef());

    assertEquals("EUR", modelTotal.getCurrency());
    assertEquals("10", modelTotal.getQuantity().toPlainString());

    assertEquals("833.30", modelTotal.getRegularPrice().toPlainString());
    assertNull(modelTotal.getSalePrice());

    assertTrue(modelTotal.isTaxInfoEnabled());
    assertTrue(modelTotal.isTaxInfoUseNet());
    assertTrue(modelTotal.isTaxInfoShowAmount());

    assertEquals("NET", modelTotal.getPriceTaxCode());
    assertEquals("20.00", modelTotal.getPriceTaxRate().toPlainString());
    assertFalse(modelTotal.isPriceTaxExclusive());
    assertEquals("166.70", modelTotal.getPriceTax().toPlainString());

    context.assertIsSatisfied();

}

From source file:jp.furplag.util.commons.NumberUtilsTest.java

/**
 * {@link jp.furplag.util.commons.NumberUtils.NumberObject}
 *//*from w w  w .  ja va2s  .  c om*/
@SuppressWarnings("unchecked")
@Test
public void NumberObjectTest() {
    try {
        Class<?> numberObject = ClassLoader.getSystemClassLoader()
                .loadClass(NumberUtils.class.getName() + "$NumberObject");

        Constructor<?> c = numberObject.getDeclaredConstructor(Class.class);
        c.setAccessible(true);

        Method ofType = numberObject.getMethod("of", Class.class);
        ofType.setAccessible(true);

        Method ofN = numberObject.getMethod("of", Number.class);
        ofN.setAccessible(true);

        Method parsable = numberObject.getDeclaredMethod("parsable", Number.class);
        parsable.setAccessible(true);

        Method contains = numberObject.getDeclaredMethod("contains", Number.class);
        contains.setAccessible(true);

        Method valueOf = numberObject.getDeclaredMethod("valueOf", Number.class);
        valueOf.setAccessible(true);

        for (Class<?> type : NUMBERS) {
            Object o = c.newInstance(type);
            Class<? extends Number> wrapper = (Class<? extends Number>) ClassUtils.primitiveToWrapper(type);
            Object numob = ofType.invoke(null, type);
            assertEquals("ofType: " + type.getSimpleName(), o, numob);
            Number n = null;
            if (!type.isPrimitive()) {
                if (ClassUtils.isPrimitiveWrapper(type)) {
                    n = (Number) ClassUtils.primitiveToWrapper(type).getMethod("valueOf", String.class)
                            .invoke(null, "1");
                } else {
                    n = (Number) type.getField("ONE").get(null);
                }
                if (type.equals(byte.class))
                    assertEquals("ofN: 1: " + type.getSimpleName(), o, ofN.invoke(null, n));
            }
            assertEquals("parsable: -1: " + type.getSimpleName(), true, parsable.invoke(numob, -1));
            assertEquals("parsable: 0: " + type.getSimpleName(), true, parsable.invoke(numob, 0));
            assertEquals("parsable: 1: " + type.getSimpleName(), true, parsable.invoke(numob, 1));

            assertEquals("parsable: null: " + type.getSimpleName(), !type.isPrimitive(),
                    parsable.invoke(numob, (Number) null));

            Object expected = ObjectUtils.isAny(wrapper, Float.class, Double.class, BigDecimal.class,
                    BigInteger.class);
            assertEquals("parsable: Infinity: Double: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Double.POSITIVE_INFINITY));
            assertEquals("parsable: Infinity: Double: BigDecimal: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_DOUBLE));
            assertEquals("parsable: Infinity: Double: BigInteger: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_DOUBLE.toBigInteger()));
            assertEquals("parsable: Infinity: Float: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Float.POSITIVE_INFINITY));
            assertEquals("parsable: Infinity: Float: BigDecimal: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_FLOAT));
            assertEquals("parsable: Infinity: Float: BigInteger: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_FLOAT.toBigInteger()));
            assertEquals("parsable: -Infinity: Double: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Double.NEGATIVE_INFINITY));
            assertEquals("parsable: -Infinity: Double: BigDecimal: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_DOUBLE.negate()));
            assertEquals("parsable: -Infinity: Double: BigInteger: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_DOUBLE.negate().toBigInteger()));
            assertEquals("parsable: -Infinity: Float: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Float.NEGATIVE_INFINITY));
            assertEquals("parsable: -Infinity: Float: BigDecimal: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_FLOAT.negate()));
            assertEquals("parsable: -Infinity: Float: BigInteger: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, INFINITY_FLOAT.negate().toBigInteger()));

            expected = ObjectUtils.isAny(wrapper, Float.class, Double.class);
            assertEquals("parsable: NaN: Float: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Float.NaN));
            assertEquals("parsable: NaN: Double: " + type.getSimpleName(), expected,
                    parsable.invoke(numob, Double.NaN));

            if (Byte.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MIN_VALUE").getByte(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getByte(null)));
                assertEquals("parsable: overflow: min: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Short.MIN_VALUE));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Short.MAX_VALUE));
                assertEquals("parsable: fraction: " + type.getSimpleName(), false,
                        parsable.invoke(numob, 123.456f));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MIN_VALUE").getByte(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getByte(null)));
                assertEquals("contains: overflow: min: " + type.getSimpleName(), false,
                        contains.invoke(numob, Short.MIN_VALUE));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, Short.MAX_VALUE));
                assertEquals("contains: fraction: " + type.getSimpleName(), true,
                        contains.invoke(numob, 123.456f));
                assertEquals("contains: overflow: fraction: " + type.getSimpleName(), false,
                        contains.invoke(numob, 1234.56f));
            }
            if (Short.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MIN_VALUE").getShort(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getShort(null)));
                assertEquals("parsable: overflow: min: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Integer.MIN_VALUE));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Integer.MAX_VALUE));
                assertEquals("parsable: fraction: " + type.getSimpleName(), false,
                        parsable.invoke(numob, 123.456f));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MIN_VALUE").getShort(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getShort(null)));
                assertEquals("contains: overflow: min: " + type.getSimpleName(), false,
                        contains.invoke(numob, Integer.MIN_VALUE));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, Integer.MAX_VALUE));
                assertEquals("contains: fraction: " + type.getSimpleName(), true,
                        contains.invoke(numob, 12345.6f));
                assertEquals("contains: overflow: fraction: " + type.getSimpleName(), false,
                        contains.invoke(numob, 123456.789f));
            }
            if (Integer.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MIN_VALUE").getInt(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getInt(null)));
                assertEquals("parsable: overflow: min: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Long.MIN_VALUE));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Long.MAX_VALUE));
                assertEquals("parsable: fraction: " + type.getSimpleName(), false,
                        parsable.invoke(numob, 123456.789f));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MIN_VALUE").getInt(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getInt(null)));
                assertEquals("contains: overflow: min: " + type.getSimpleName(), false,
                        contains.invoke(numob, Long.MIN_VALUE));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, Long.MAX_VALUE));
                assertEquals("contains: fraction: " + type.getSimpleName(), true,
                        contains.invoke(numob, 123456.789f));
                assertEquals("contains: overflow: fraction: " + type.getSimpleName(), false,
                        contains.invoke(numob, 12345678912345678912.3456d));
            }
            if (Long.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MIN_VALUE").getLong(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getLong(null)));
                assertEquals("parsable: overflow: min: " + type.getSimpleName(), false,
                        parsable.invoke(numob, BigInteger.valueOf(Long.MIN_VALUE).pow(2)));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, BigInteger.valueOf(Long.MAX_VALUE).pow(2)));
                assertEquals("parsable: fraction: " + type.getSimpleName(), false,
                        parsable.invoke(numob, 123.456f));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MIN_VALUE").getLong(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getLong(null)));
                assertEquals("contains: overflow: min: " + type.getSimpleName(), false,
                        contains.invoke(numob, BigInteger.valueOf(Long.MIN_VALUE).pow(2)));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, BigInteger.valueOf(Long.MAX_VALUE).pow(2)));
                assertEquals("contains: fraction: " + type.getSimpleName(), true,
                        contains.invoke(numob, 123456.789f));
                assertEquals("contains: overflow: fraction: " + type.getSimpleName(), false,
                        contains.invoke(numob, 12345678912345678912.3456f));
            }
            if (Float.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, -wrapper.getField("MAX_VALUE").getFloat(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getFloat(null)));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, -Double.MAX_VALUE));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), false,
                        parsable.invoke(numob, Double.MAX_VALUE));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, -wrapper.getField("MAX_VALUE").getFloat(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getFloat(null)));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, -Double.MAX_VALUE));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, Double.MAX_VALUE));
            }
            if (Double.class.equals(wrapper)) {
                assertEquals("parsable: contains: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, -wrapper.getField("MAX_VALUE").getDouble(null)));
                assertEquals("parsable: contains: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, wrapper.getField("MAX_VALUE").getDouble(null)));
                assertEquals("parsable: overflow: min: " + type.getSimpleName(), true,
                        parsable.invoke(numob, INFINITY_DOUBLE.multiply(BigDecimal.TEN).negate()));
                assertEquals("parsable: overflow: max: " + type.getSimpleName(), true,
                        parsable.invoke(numob, INFINITY_DOUBLE.multiply(BigDecimal.TEN)));

                assertEquals("contains: min: " + type.getSimpleName(), true,
                        contains.invoke(numob, -wrapper.getField("MAX_VALUE").getDouble(null)));
                assertEquals("contains: max: " + type.getSimpleName(), true,
                        contains.invoke(numob, wrapper.getField("MAX_VALUE").getDouble(null)));
                assertEquals("contains: overflow: min: " + type.getSimpleName(), false,
                        contains.invoke(numob, INFINITY_DOUBLE.multiply(BigDecimal.TEN).negate()));
                assertEquals("contains: overflow: max: " + type.getSimpleName(), false,
                        contains.invoke(numob, INFINITY_DOUBLE.multiply(BigDecimal.TEN)));
            }
            if (!ClassUtils.isPrimitiveWrapper(wrapper)) {
                assertEquals("parsable: fraction: " + type.getSimpleName(), BigDecimal.class.equals(type),
                        parsable.invoke(numob, 123.456f));
                assertEquals("contains: fraction: " + type.getSimpleName(), true,
                        contains.invoke(numob, 123.456f));
            }

            if (ClassUtils.isPrimitiveWrapper(wrapper)) {
                expected = wrapper.getMethod("valueOf", String.class).invoke(null, "123");
            } else {
                expected = new BigDecimal("123");
                if (BigInteger.class.equals(wrapper))
                    expected = ((BigDecimal) expected).toBigInteger();
            }
            for (Class<?> valueType : OBJECTS) {
                if (ClassUtils.isPrimitiveWrapper(valueType)) {
                    n = (Number) valueType.getMethod("valueOf", String.class).invoke(null, "123");
                } else {
                    n = new BigDecimal("123");
                    if (BigInteger.class.equals(valueType))
                        n = ((BigDecimal) n).toBigInteger();
                }
                assertEquals(
                        "valueOf: " + n + " (" + n.getClass().getSimpleName() + "): " + type.getSimpleName(),
                        expected, valueOf.invoke(numob, n));
                assertEquals(
                        "valueOf: " + n + " (" + n.getClass().getSimpleName() + "): class: "
                                + type.getSimpleName(),
                        expected.getClass(), valueOf.invoke(numob, n).getClass());
            }

            n = 123.456f;
            if (ObjectUtils.isAny(wrapper, Float.class, Double.class)) {
                expected = wrapper.getMethod("valueOf", String.class).invoke(null, n.toString());
            } else if (ClassUtils.isPrimitiveWrapper(wrapper)) {
                expected = wrapper.getMethod("valueOf", String.class).invoke(null,
                        Integer.toString(((Float) n).intValue()));
            } else {
                expected = new BigDecimal(n.toString());
                if (BigInteger.class.equals(wrapper))
                    expected = ((BigDecimal) expected).toBigInteger();
            }
            assertEquals("valueOf: " + n + " (" + n.getClass().getSimpleName() + "): " + type.getSimpleName(),
                    expected, valueOf.invoke(numob, n));
            assertEquals(
                    "valueOf: " + n + " (" + n.getClass().getSimpleName() + "): class: " + type.getSimpleName(),
                    expected.getClass(), valueOf.invoke(numob, n).getClass());

            n = 1.23456789E-6d;
            if (ObjectUtils.isAny(wrapper, Float.class, Double.class)) {
                expected = wrapper.getMethod("valueOf", String.class).invoke(null, n.toString());
            } else if (ClassUtils.isPrimitiveWrapper(wrapper)) {
                expected = wrapper.getMethod("valueOf", String.class).invoke(null,
                        Integer.toString(((Double) n).intValue()));
            } else {
                expected = new BigDecimal(n.toString());
                if (BigInteger.class.equals(wrapper))
                    expected = ((BigDecimal) expected).toBigInteger();
            }
            assertEquals("valueOf: " + n + " (" + n.getClass().getSimpleName() + "): " + type.getSimpleName(),
                    expected, valueOf.invoke(numob, n));
            assertEquals(
                    "valueOf: " + n + " (" + n.getClass().getSimpleName() + "): class: " + type.getSimpleName(),
                    expected.getClass(), valueOf.invoke(numob, n).getClass());

            n = INFINITY_DOUBLE.pow(2);
            if (ObjectUtils.isAny(wrapper, Float.class, Double.class)) {
                expected = wrapper.getField("POSITIVE_INFINITY").get(null);
            } else if (ClassUtils.isPrimitiveWrapper(wrapper)) {
                expected = wrapper.getField("MAX_VALUE").get(null);
            } else {
                expected = new BigDecimal(n.toString());
                if (BigInteger.class.equals(wrapper))
                    expected = ((BigDecimal) expected).toBigInteger();
            }
            assertEquals("valueOf: Huge: " + type.getSimpleName(), expected, valueOf.invoke(numob, n));
            assertEquals("valueOf: Huge: class: " + type.getSimpleName(), expected.getClass(),
                    valueOf.invoke(numob, n).getClass());

            n = INFINITY_DOUBLE.pow(2).negate();
            if (ObjectUtils.isAny(wrapper, Float.class, Double.class)) {
                expected = wrapper.getField("NEGATIVE_INFINITY").get(null);
            } else if (ClassUtils.isPrimitiveWrapper(wrapper)) {
                expected = wrapper.getField("MIN_VALUE").get(null);
            } else {
                expected = new BigDecimal(n.toString());
                if (BigInteger.class.equals(wrapper))
                    expected = ((BigDecimal) expected).toBigInteger();
            }
            assertEquals("valueOf: Huge: negative: " + type.getSimpleName(), expected,
                    valueOf.invoke(numob, n));
            assertEquals("valueOf: Huge: negative: class: " + type.getSimpleName(), expected.getClass(),
                    valueOf.invoke(numob, n).getClass());
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage() + "\n" + Arrays.toString(e.getStackTrace()));
    }
}