// Path: src/test/java/com/arangodb/example/ExampleBase.java
// public class ExampleBase {
// 
//     private static final String DB_NAME = "json_example_db";
//     protected static final String COLLECTION_NAME = "json_example_collection";
// 
//     private static ArangoDBAsync arangoDB;
//     protected static ArangoDatabaseAsync db;
//     protected static ArangoCollectionAsync collection;
// 
//     @BeforeClass
//     public static void setUp() throws InterruptedException, ExecutionException {
//         arangoDB = new ArangoDBAsync.Builder().build();
//         if (arangoDB.db(DB_NAME).exists().get()) {
//             arangoDB.db(DB_NAME).drop().get();
//         }
//         arangoDB.createDatabase(DB_NAME).get();
//         db = arangoDB.db(DB_NAME);
//         db.createCollection(COLLECTION_NAME).get();
//         collection = db.collection(COLLECTION_NAME);
//     }
// 
//     @AfterClass
//     public static void tearDown() throws InterruptedException, ExecutionException {
//         db.drop().get();
//         arangoDB.shutdown();
//     }
// 
// }


import com.arangodb.entity.DocumentCreateEntity;
import com.arangodb.example.ExampleBase;
import com.arangodb.velocypack.VPackSlice;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.concurrent.ExecutionException;
import org.junit.BeforeClass;
import org.junit.Test;
import com.arangodb.entity.BaseDocument;
                .get();
    }

    @Test
    public void getAsBaseDocument() throws InterruptedException, ExecutionException {
        collection.getDocument(key, BaseDocument.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
                    assertThat(doc.getAttribute("foo"), is(notNullValue()));
                    assertThat(String.valueOf(doc.getAttribute("foo")), is("bar"));
                })
                .get();
    }

    @Test
    public void getAsVPack() throws InterruptedException, ExecutionException {
        collection.getDocument(key, VPackSlice.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
                    assertThat(doc.get("foo").isString(), is(true));
                    assertThat(doc.get("foo").getAsString(), is("bar"));
                })
                .get();
    }

    @Test
    public void getAsJson() throws InterruptedException, ExecutionException {
        collection.getDocument(key, String.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
// Path: src/test/java/com/arangodb/example/ExampleBase.java
// public class ExampleBase {
// 
//     private static final String DB_NAME = "json_example_db";
//     protected static final String COLLECTION_NAME = "json_example_collection";
// 
//     private static ArangoDBAsync arangoDB;
//     protected static ArangoDatabaseAsync db;
//     protected static ArangoCollectionAsync collection;
// 
//     @BeforeClass
//     public static void setUp() throws InterruptedException, ExecutionException {
//         arangoDB = new ArangoDBAsync.Builder().build();
//         if (arangoDB.db(DB_NAME).exists().get()) {
//             arangoDB.db(DB_NAME).drop().get();
//         }
//         arangoDB.createDatabase(DB_NAME).get();
//         db = arangoDB.db(DB_NAME);
//         db.createCollection(COLLECTION_NAME).get();
//         collection = db.collection(COLLECTION_NAME);
//     }
// 
//     @AfterClass
//     public static void tearDown() throws InterruptedException, ExecutionException {
//         db.drop().get();
//         arangoDB.shutdown();
//     }
// 
// }


// Path: src/test/java/com/arangodb/example/document/GetDocumentExample.java
import com.arangodb.entity.DocumentCreateEntity;
import com.arangodb.example.ExampleBase;
import com.arangodb.velocypack.VPackSlice;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import java.util.concurrent.ExecutionException;
import org.junit.BeforeClass;
import org.junit.Test;
import com.arangodb.entity.BaseDocument;

                .get();
    }

    @Test
    public void getAsBaseDocument() throws InterruptedException, ExecutionException {
        collection.getDocument(key, BaseDocument.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
                    assertThat(doc.getAttribute("foo"), is(notNullValue()));
                    assertThat(String.valueOf(doc.getAttribute("foo")), is("bar"));
                })
                .get();
    }

    @Test
    public void getAsVPack() throws InterruptedException, ExecutionException {
        collection.getDocument(key, VPackSlice.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
                    assertThat(doc.get("foo").isString(), is(true));
                    assertThat(doc.get("foo").getAsString(), is("bar"));
                })
                .get();
    }

    @Test
    public void getAsJson() throws InterruptedException, ExecutionException {
        collection.getDocument(key, String.class)
                .whenComplete((doc, ex) -> {
                    assertThat(doc, is(notNullValue()));
                    assertThat(doc.contains("foo"), is(true));