}
@Test
public void shouldDoubleUpsertDesignDocument() {
List<View> views = Arrays.asList(DefaultView.create("v1", "function(d,m){}"));
DesignDocument designDocument = DesignDocument.create("upsert2", views);
manager.upsertDesignDocument(designDocument);
DesignDocument found = manager.getDesignDocument("upsert2");
assertNotNull(found);
assertEquals("upsert2", found.name());
assertEquals(1, found.views().size());
assertEquals("function(d,m){}", found.views().get(0).map());
assertNull(found.views().get(0).reduce());
views = Arrays.asList(
DefaultView.create("v1", "function(d,m){}", "_count"),
DefaultView.create("v2", "function(d,m){}", "_count")
);
designDocument = DesignDocument.create("upsert2", views);
manager.upsertDesignDocument(designDocument);
found = manager.getDesignDocument("upsert2");
assertNotNull(found);
assertEquals("upsert2", found.name());
assertEquals(2, found.views().size());
assertEquals("function(d,m){}", found.views().get(0).map());
assertEquals("_count", found.views().get(0).reduce());
assertEquals("function(d,m){}", found.views().get(1).map());
assertEquals("_count", found.views().get(1).reduce());
}