@@ -2830,16 +2830,26 @@ void changeProperties(ArangoCollection collection) {
28302830 void rename (ArangoCollection collection ) {
28312831 assumeTrue (isSingleServer ());
28322832 ArangoDatabase db = collection .db ();
2833- final CollectionEntity result = collection .rename (COLLECTION_NAME + "1" );
2833+
2834+ if (!db .collection ("c1" ).exists ()) {
2835+ db .collection ("c1" ).create ();
2836+ }
2837+
2838+ if (db .collection ("c2" ).exists ()) {
2839+ db .collection ("c2" ).drop ();
2840+ }
2841+
2842+ final CollectionEntity result = db .collection ("c1" ).rename ("c2" );
28342843 assertThat (result ).isNotNull ();
2835- assertThat (result .getName ()).isEqualTo (COLLECTION_NAME + "1" );
2836- final CollectionEntity info = db .collection (COLLECTION_NAME + "1" ).getInfo ();
2837- assertThat (info .getName ()).isEqualTo (COLLECTION_NAME + "1" );
2838- Throwable thrown = catchThrowable (() -> db .collection (COLLECTION_NAME ).getInfo ());
2844+ assertThat (result .getName ()).isEqualTo ("c2" );
2845+
2846+ final CollectionEntity info = db .collection ("c2" ).getInfo ();
2847+ assertThat (info .getName ()).isEqualTo ("c2" );
2848+
2849+ Throwable thrown = catchThrowable (() -> db .collection ("c1" ).getInfo ());
28392850 assertThat (thrown ).isInstanceOf (ArangoDBException .class );
28402851 ArangoDBException e = (ArangoDBException ) thrown ;
28412852 assertThat (e .getResponseCode ()).isEqualTo (404 );
2842- db .collection (COLLECTION_NAME + "1" ).rename (COLLECTION_NAME );
28432853 }
28442854
28452855 @ ParameterizedTest (name = "{index}" )
@@ -2852,15 +2862,6 @@ void responsibleShard(ArangoCollection collection) {
28522862 assertThat (shard .getShardId ()).isNotNull ();
28532863 }
28542864
2855- @ ParameterizedTest (name = "{index}" )
2856- @ MethodSource ("cols" )
2857- void renameDontBreaksCollectionHandler (ArangoCollection collection ) {
2858- assumeTrue (isSingleServer ());
2859- collection .rename (COLLECTION_NAME + "1" );
2860- assertThat (collection .getInfo ()).isNotNull ();
2861- collection .db ().collection (COLLECTION_NAME + "1" ).rename (COLLECTION_NAME );
2862- }
2863-
28642865 @ ParameterizedTest (name = "{index}" )
28652866 @ MethodSource ("cols" )
28662867 void getRevision (ArangoCollection collection ) {
0 commit comments