15
15
*/
16
16
package org .springframework .data .couchbase .repository .query ;
17
17
18
- import static com .couchbase .client .core .io .CollectionIdentifier .DEFAULT_SCOPE ;
19
18
import static org .junit .jupiter .api .Assertions .assertEquals ;
20
19
import static org .junit .jupiter .api .Assertions .assertThrows ;
21
20
@@ -179,7 +178,7 @@ public void testScopeCollectionAnnotation() {
179
178
// scope
180
179
List <UserCol > found = userColRepository .withCollection (otherCollection ).findByFirstname (user .getFirstname ());
181
180
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 )
183
182
.withCollection (CollectionIdentifier .DEFAULT_COLLECTION ).findByFirstname (user .getFirstname ());
184
183
assertEquals (0 , notfound .size (), "should not have found what was saved" );
185
184
} finally {
@@ -189,20 +188,6 @@ public void testScopeCollectionAnnotation() {
189
188
}
190
189
}
191
190
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
-
206
191
// template default scope is my_scope
207
192
// UserCol annotation scope is other_scope
208
193
@ Test
@@ -213,7 +198,7 @@ public void testScopeCollectionRepoWith() {
213
198
List <UserCol > found = userColRepository .withScope (scopeName ).withCollection (collectionName )
214
199
.findByFirstname (user .getFirstname ());
215
200
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 )
217
202
.withCollection (CollectionIdentifier .DEFAULT_COLLECTION ).findByFirstname (user .getFirstname ());
218
203
assertEquals (0 , notfound .size (), "should not have found what was saved" );
219
204
userColRepository .withScope (scopeName ).withCollection (collectionName ).delete (user );
0 commit comments