2121import static org .hamcrest .CoreMatchers .not ;
2222import static org .hamcrest .CoreMatchers .notNullValue ;
2323import static org .hamcrest .CoreMatchers .nullValue ;
24+ import static org .junit .Assert .assertEquals ;
2425import static org .junit .Assert .assertThat ;
26+ import static org .junit .Assert .assertTrue ;
2527import static org .junit .Assert .fail ;
2628
2729import java .util .Arrays ;
28- import java .util .Set ;
29- import java .util .TreeSet ;
30+ import java .util .List ;
3031
3132import org .junit .After ;
3233import org .junit .Before ;
@@ -267,15 +268,22 @@ public void test_getDocuments() throws ArangoException {
267268 assertThat (doc2 , is (notNullValue ()));
268269 assertThat (doc3 , is (notNullValue ()));
269270
270- //
271- Set <String > tree = new TreeSet <String >(Arrays .asList ("/_api/document/" + doc1 .getDocumentHandle (),
272- "/_api/document/" + doc2 .getDocumentHandle (), "/_api/document/" + doc3 .getDocumentHandle ()));
273-
274271 // get documents
275- Set <String > docIds = new TreeSet <String >(driver .getDocuments (collectionName ));
276- assertThat (docIds .size (), is (3 ));
272+ List <String > documents = driver .getDocuments (collectionName );
273+ assertEquals (3 , documents .size ());
274+
275+ String prefix ;
276+ if (documents .get (0 ).startsWith ("/_db/" )) {
277+ // since ArangoDB 2.6
278+ prefix = "/_db/" + DATABASE_NAME + "/_api/document/" ;
279+ } else {
280+ prefix = "/_api/document/" ;
281+ }
282+
283+ List <String > list = Arrays .asList (prefix + doc1 .getDocumentHandle (), prefix + doc2 .getDocumentHandle (), prefix
284+ + doc3 .getDocumentHandle ());
277285
278- assertThat ( docIds , is ( tree ));
286+ assertTrue ( documents . containsAll ( list ));
279287 }
280288
281289 @ Test
@@ -292,15 +300,22 @@ public void test_getDocuments_handle() throws ArangoException {
292300 assertThat (doc2 , is (notNullValue ()));
293301 assertThat (doc3 , is (notNullValue ()));
294302
295- //
296- Set <String > tree = new TreeSet <String >(Arrays .asList (doc1 .getDocumentHandle (), doc2 .getDocumentHandle (),
297- doc3 .getDocumentHandle ()));
298-
299303 // get documents
300- Set <String > docIds = new TreeSet <String >(driver .getDocuments (collectionName , true ));
301- assertThat (docIds .size (), is (3 ));
302- assertThat (docIds , is (tree ));
304+ List <String > documents = driver .getDocuments (collectionName , true );
305+ assertEquals (3 , documents .size ());
306+
307+ String prefix ;
308+ if (documents .get (0 ).startsWith ("/_db/" )) {
309+ // since ArangoDB 2.6
310+ prefix = "/_db/" + DATABASE_NAME + "/_api/document/" ;
311+ } else {
312+ prefix = "" ;
313+ }
314+
315+ List <String > list = Arrays .asList (prefix + doc1 .getDocumentHandle (), prefix + doc2 .getDocumentHandle (), prefix
316+ + doc3 .getDocumentHandle ());
303317
318+ assertTrue (documents .containsAll (list ));
304319 }
305320
306321 @ Test
0 commit comments