@Test
  public void testConstructorWithEmptyCollectionOverwrites() {
    JsonArrayDocument preExisting = JsonArrayDocument.create(uuid, JsonArray.from("test", "test2"));
    bucket.upsert(preExisting);

    Map<String, Object> map =
        new CouchbaseMap<Object>(uuid, bucket, Collections.<String, Object>emptyMap());

    assertEquals(0, map.size());
  }
  @Test
  public void testConstructorWithCollectionDataOverwrites() {
    JsonArrayDocument preExisting = JsonArrayDocument.create(uuid, JsonArray.from("test", "test2"));
    bucket.upsert(preExisting);

    Map<String, Object> map =
        new CouchbaseMap<Object>(uuid, bucket, Collections.singletonMap("foo", "bar"));

    assertEquals(1, map.size());
    assertTrue(map.containsKey("foo"));
    assertEquals("bar", map.get("foo"));
  }
  @Test
  public void testConstructorWithPreExistingDocumentOfWrongTypeFails() {
    JsonArrayDocument preExisting = JsonArrayDocument.create(uuid, JsonArray.from("test"));
    bucket.upsert(preExisting);

    Map<String, Object> map = new CouchbaseMap<Object>(uuid, bucket);
    try {
      map.size();
      fail("Expected TranscodingException");
    } catch (TranscodingException e) {
      // expected
    }
  }