Пример #1
0
        static void testGetBlobValue()
        {
            Blob      helloWorld = Blob.valueOf("HelloWorld");
            string    encoded    = EncodingUtil.base64Encode(helloWorld);
            JSONParse parser     = new JSONParse("\"" + encoded + "\"");

            System.assertEquals(encoded, parser.getStringValue());
            System.assertEquals(helloWorld, parser.getBlobValue());
            try
            {
                parser = new JSONParse("42");
                parser.getBlobValue();
                System.assert(false, "Node is not a valid Blob, should have seen an exception about that.");
            }
            catch (JSONParse.InvalidConversionException e)
            {
                System.assertEquals("Only String values can be converted to a Blob: 42", e.getMessage());
            }
        }