FileDocCategorySizeDatePackage
RoundingModeTest.javaAPI DocAndroid 1.5 API2799Wed May 06 22:41:04 BST 2009tests.api.java.math

RoundingModeTest

public class RoundingModeTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtest_valueOfI()

tests
java.math.RoundingMode#valueOf(int)

        assertEquals("valueOf failed for ROUND_CEILING", RoundingMode.valueOf(BigDecimal.ROUND_CEILING), RoundingMode.CEILING);
        assertEquals("valueOf failed for ROUND_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_DOWN), RoundingMode.DOWN);
        assertEquals("valueOf failed for ROUND_FLOOR", RoundingMode.valueOf(BigDecimal.ROUND_FLOOR), RoundingMode.FLOOR);
        assertEquals("valueOf failed for ROUND_HALF_DOWN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_DOWN), RoundingMode.HALF_DOWN);
        assertEquals("valueOf failed for ROUND_HALF_EVEN", RoundingMode.valueOf(BigDecimal.ROUND_HALF_EVEN), RoundingMode.HALF_EVEN);
        assertEquals("valueOf failed for ROUND_HALF_UP", RoundingMode.valueOf(BigDecimal.ROUND_HALF_UP), RoundingMode.HALF_UP);
        assertEquals("valueOf failed for ROUND_UNNECESSARY", RoundingMode.valueOf(BigDecimal.ROUND_UNNECESSARY), RoundingMode.UNNECESSARY);
        assertEquals("valueOf failed for ROUND_UP", RoundingMode.valueOf(BigDecimal.ROUND_UP), RoundingMode.UP);
        try {
            RoundingMode.valueOf(13);
            fail("IllegalArgumentException expected for RoundingMode(13)");
        } catch (IllegalArgumentException e) {
        }
        try {
            RoundingMode.valueOf(-1);
            fail("IllegalArgumentException expected for RoundingMode(-1)");
        } catch (IllegalArgumentException e) {
        }