1515 */
1616package org .springframework .data .couchbase .repository .query ;
1717
18- import static com .couchbase .client .core .io .CollectionIdentifier .DEFAULT_SCOPE ;
1918import static org .junit .jupiter .api .Assertions .assertEquals ;
2019import static org .junit .jupiter .api .Assertions .assertThrows ;
2120
@@ -179,7 +178,7 @@ public void testScopeCollectionAnnotation() {
179178 // scope
180179 List <UserCol > found = userColRepository .withCollection (otherCollection ).findByFirstname (user .getFirstname ());
181180 assertEquals (saved , found .get (0 ), "should have found what was saved" );
182- List <UserCol > notfound = userColRepository .withScope (DEFAULT_SCOPE )
181+ List <UserCol > notfound = userColRepository .withScope (CollectionIdentifier . DEFAULT_SCOPE )
183182 .withCollection (CollectionIdentifier .DEFAULT_COLLECTION ).findByFirstname (user .getFirstname ());
184183 assertEquals (0 , notfound .size (), "should not have found what was saved" );
185184 } finally {
@@ -189,20 +188,6 @@ public void testScopeCollectionAnnotation() {
189188 }
190189 }
191190
192- @ Test
193- public void testScopeCollectionAnnotationSwap () {
194- // UserCol annotation scope is other_scope, collection is other_collection
195- // airportRepository relies on Config.setScopeName(scopeName) ("my_scope") from CollectionAwareIntegrationTests.
196- // using airportRepository without specified a collection should fail.
197- // This test ensures that airportRepository.save(airport) doesn't get the
198- // collection from CrudMethodMetadata of UserCol.save()
199- UserCol userCol = new UserCol ("1" , "Dave" , "Wilson" );
200- Airport airport = new Airport ("3" , "myIata" , "myIcao" );
201- UserCol savedCol = userColRepository .save (userCol ); // uses UserCol annotation scope, populates CrudMethodMetadata
202- userColRepository .delete (userCol ); // uses UserCol annotation scope, populates CrudMethodMetadata
203- assertThrows (IllegalStateException .class , () -> airportRepository .save (airport ));
204- }
205-
206191 // template default scope is my_scope
207192 // UserCol annotation scope is other_scope
208193 @ Test
@@ -213,7 +198,7 @@ public void testScopeCollectionRepoWith() {
213198 List <UserCol > found = userColRepository .withScope (scopeName ).withCollection (collectionName )
214199 .findByFirstname (user .getFirstname ());
215200 assertEquals (saved , found .get (0 ), "should have found what was saved" );
216- List <UserCol > notfound = userColRepository .withScope (DEFAULT_SCOPE )
201+ List <UserCol > notfound = userColRepository .withScope (CollectionIdentifier . DEFAULT_SCOPE )
217202 .withCollection (CollectionIdentifier .DEFAULT_COLLECTION ).findByFirstname (user .getFirstname ());
218203 assertEquals (0 , notfound .size (), "should not have found what was saved" );
219204 userColRepository .withScope (scopeName ).withCollection (collectionName ).delete (user );
0 commit comments