Esempio n. 1
0
        static void testGetTimeValue()
        {
            JSONParse parser = new JSONParse("\"2011-03-22T13:01:23\"");

            System.assertEquals(Time.newInstance(13, 1, 23, 0), parser.getTimeValue());
            parser = new JSONParse("1538783039073");
            System.assertEquals(Time.newInstance(23, 43, 59, 73), parser.getTimeValue());
            try
            {
                parser = new JSONParse("[1,2,3]");
                parser.getTimeValue();
                System.assert(false, "Node is not a valid Time, should have seen an exception about that.");
            }
            catch (JSONParse.InvalidConversionException e)
            {
                System.assertEquals("Only Long and String values can be converted to a Time: [ 1, 2, 3 ]", e.getMessage());
            }
        }