@Test
    public void testTensorShortForm() throws IOException {
        DocumentType documentTypeWithTensor = types.getDocumentType("testindexedtensor");
        String docId = "id:unittest:testindexedtensor::0";
        Document doc = new Document(documentTypeWithTensor, docId);
        Field tensorField = documentTypeWithTensor.getField("tensorfield");
        Tensor tensor = Tensor.from("tensor(x[3]):[1,2,3]");
        doc.setFieldValue(tensorField, new TensorFieldValue(tensor));

        assertEqualJson(asDocument(docId, "{ \"tensorfield\": {\"type\":\"tensor(x[3])\", \"cells\":[{\"address\":{\"x\":\"0\"},\"value\":1.0},{\"address\":{\"x\":\"1\"},\"value\":2.0},{\"address\":{\"x\":\"2\"},\"value\":3.0}]} }"),
                        writeDocument(doc, false, false));
        assertEqualJson(asDocument(docId, "{ \"tensorfield\": {\"type\":\"tensor(x[3])\", \"values\":[1.0, 2.0, 3.0] } }"),
                        writeDocument(doc, true, false));
    }
Functional tests for com.yahoo.document.json.JsonWriter.

@author Steinar Knutsen
document/src/test/java/com/yahoo/document/json/JsonWriterTestCase.java