@@ -2830,16 +2830,26 @@ void changeProperties(ArangoCollection collection) {
2830
2830
void rename (ArangoCollection collection ) {
2831
2831
assumeTrue (isSingleServer ());
2832
2832
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" );
2834
2843
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 ());
2839
2850
assertThat (thrown ).isInstanceOf (ArangoDBException .class );
2840
2851
ArangoDBException e = (ArangoDBException ) thrown ;
2841
2852
assertThat (e .getResponseCode ()).isEqualTo (404 );
2842
- db .collection (COLLECTION_NAME + "1" ).rename (COLLECTION_NAME );
2843
2853
}
2844
2854
2845
2855
@ ParameterizedTest (name = "{index}" )
@@ -2852,15 +2862,6 @@ void responsibleShard(ArangoCollection collection) {
2852
2862
assertThat (shard .getShardId ()).isNotNull ();
2853
2863
}
2854
2864
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
-
2864
2865
@ ParameterizedTest (name = "{index}" )
2865
2866
@ MethodSource ("cols" )
2866
2867
void getRevision (ArangoCollection collection ) {
0 commit comments