@Test
public void testIntFormat() {

    DecimalType dt;
    // Basic test with an integer value.
    dt = new DecimalType("87");
    assertEquals("87", dt.format("%d"));
    // Again an integer value, but this time an "advanced" pattern.
    dt = new DecimalType("87");
    assertEquals(" 87", dt.format("%3d"));
    // Again an integer value, but this time an "advanced" pattern.
    dt = new DecimalType("87");
    assertEquals("0x57", dt.format("%#x"));
    // A float value cannot be converted into hex.
    dt = new DecimalType("87.5");
    try {
        dt.format("%x");
        fail();
    } catch (Exception e) {
        // That's what we expect.
    }
    // An integer (with different representation) with int conversion.
    dt = new DecimalType("11.0");
    assertEquals("11", dt.format("%d"));
}