use of com.torodb.kvdocument.values.KvDocument in project torodb by torodb.
the class TestConvertJson method parseMultiArrayWithValue.
@Test
public void parseMultiArrayWithValue() {
KvDocument doc = parser.createFromResource("MultiArray.json");
KvArray array = (KvArray) doc.get("months");
KvArray inner = (KvArray) array.get(0);
assertEquals("April", inner.get(0).getValue());
}
use of com.torodb.kvdocument.values.KvDocument in project torodb by torodb.
the class TestConvertJson method parseField.
@Test
public void parseField() {
KvDocument doc = parser.createFromResource("OneField.json");
assertEquals(1, doc.size());
assertTrue(doc.containsKey("name"));
assertEquals("John", doc.get("name").getValue());
}
use of com.torodb.kvdocument.values.KvDocument in project torodb by torodb.
the class TestConvertJson method parse_id.
@Test
public void parse_id() {
KvDocument doc = parser.createFromResource("_idField.json");
assertTrue(doc.containsKey("_id"));
KvValue<?> id = doc.get("_id");
assertTrue(id instanceof KvMongoObjectId);
assertEquals("55129FF25916F02D31387E1C", id.toString());
}
use of com.torodb.kvdocument.values.KvDocument in project torodb by torodb.
the class TestConvertJson method parseMultiArrayEmpty.
@Test
public void parseMultiArrayEmpty() {
KvDocument doc = parser.createFromResource("MultiArrayEmpty.json");
KvArray array = (KvArray) doc.get("months");
assertEquals(1, array.size());
assertTrue(array.get(0) instanceof KvArray);
KvArray inner = (KvArray) array.get(0);
assertEquals(0, inner.size());
}
use of com.torodb.kvdocument.values.KvDocument in project torodb by torodb.
the class TestConvertJson method parseEmptyArray.
@Test
public void parseEmptyArray() {
KvDocument doc = parser.createFromResource("EmptyArray.json");
assertTrue(doc.containsKey("department"));
assertTrue(doc.get("department") instanceof KvArray);
assertTrue(((KvArray) doc.get("department")).size() == 0);
}
Aggregations