@Test
public void testToString() throws Exception {

    Value i = this.getLocalValue("i");
    assertEquals("NumericFormatter should be able to format int correctly.", "111", formatter.toString(i, new HashMap<>()));
    VirtualMachine vm = getVM();
    assertEquals("NumericFormatter should be able to format double correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0), new HashMap<>()));
    assertEquals("NumericFormatter should be able to format float correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0f), new HashMap<>()));
    Map<String, Object> options = formatter.getDefaultOptions();
    options.put(NUMERIC_PRECISION_OPTION, 1);
    assertEquals("NumericFormatter should be able to format double correctly.", "111.0",
        formatter.toString(vm.mirrorOf(111.0), options));
    assertEquals("NumericFormatter should be able to format float correctly.", "111.0",
        formatter.toString(vm.mirrorOf(111.0f), options));
    options.put(NUMERIC_PRECISION_OPTION, -1);
    assertEquals("NumericFormatter should be able to format double correctly.", "111.000000",
        formatter.toString(vm.mirrorOf(111.0), options));
}