@Test
    public void testEmptySparseTensor() {
        Tensor.Builder builder = Tensor.Builder.of(TensorType.fromSpec("tensor(x{},y{})"));
        Tensor tensor = builder.build();
        byte[] json = JsonFormat.encode(tensor, false, false);
        assertEquals("{\"type\":\"tensor(x{},y{})\",\"cells\":[]}",
                     new String(json, StandardCharsets.UTF_8));
        Tensor decoded = JsonFormat.decode(tensor.type(), json);
        assertEquals(tensor, decoded);

        json = "{}".getBytes(); // short form variant of the above
        decoded = JsonFormat.decode(tensor.type(), json);
        assertEquals(tensor, decoded);
    }
Tests parsing of various tensor values set at the root, i.e. no 'cells', 'blocks' or 'values'
vespajlib/src/test/java/com/yahoo/tensor/serialization/JsonFormatTestCase.java