@@ -199,7 +199,9 @@ void testAdd() throws Exception {
199
199
// Add the project.
200
200
env .setScanningDepth (3 );
201
201
202
- addProject ("mercurial" );
202
+ try (Response response = addProject ("mercurial" )) {
203
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
204
+ }
203
205
204
206
// Check that the project was added properly.
205
207
assertTrue (env .getProjects ().containsKey ("mercurial" ));
@@ -224,7 +226,9 @@ void testAdd() throws Exception {
224
226
// At the same time, it checks that multiple projects can be added
225
227
// with single message.
226
228
227
- addProject ("git" );
229
+ try (Response response = addProject ("git" )) {
230
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
231
+ }
228
232
229
233
assertEquals (2 , env .getProjects ().size ());
230
234
assertEquals (3 , env .getRepositories ().size ());
@@ -370,7 +374,10 @@ private Response deleteProject(final String project) throws InterruptedException
370
374
void testDeleteCache (boolean historyCache ) throws Exception {
371
375
final String cacheName = historyCache ? "historycache" : "annotationcache" ;
372
376
final String projectName = "git" ;
373
- addProject (projectName );
377
+
378
+ try (Response response = addProject (projectName )) {
379
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
380
+ }
374
381
375
382
Indexer .getInstance ().prepareIndexer (
376
383
env ,
@@ -424,7 +431,9 @@ void testIndexed() throws Exception {
424
431
String projectName = "mercurial" ;
425
432
426
433
// When a project is added, it should be marked as not indexed.
427
- addProject (projectName );
434
+ try (Response response = addProject (projectName )) {
435
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
436
+ }
428
437
429
438
assertFalse (env .getProjects ().get (projectName ).isIndexed ());
430
439
@@ -480,11 +489,15 @@ private Response markIndexed(final String project) throws InterruptedException {
480
489
481
490
@ Test
482
491
void testList () throws Exception {
483
- addProject ("mercurial" );
492
+ try (Response response = addProject ("mercurial" )) {
493
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
494
+ }
484
495
assertEquals (markIndexed ("mercurial" ).getStatusInfo ().getFamily (), Response .Status .Family .SUCCESSFUL );
485
496
486
497
// Add another project.
487
- addProject ("git" );
498
+ try (Response response = addProject ("git" )) {
499
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
500
+ }
488
501
489
502
GenericType <List <String >> type = new GenericType <>() {
490
503
};
@@ -531,7 +544,9 @@ void testGetRepos() throws Exception {
531
544
"clone" , mercurialRoot .getAbsolutePath (),
532
545
mercurialRoot .getAbsolutePath () + File .separator + "closed" );
533
546
534
- addProject ("mercurial" );
547
+ try (Response response = addProject ("mercurial" )) {
548
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
549
+ }
535
550
536
551
// Get repositories of the project.
537
552
List <String > repos = target ("projects" )
@@ -565,7 +580,9 @@ void testGetRepos() throws Exception {
565
580
@ Test
566
581
void testSetIndexed () throws Exception {
567
582
String project = "git" ;
568
- addProject (project );
583
+ try (Response response = addProject (project )) {
584
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
585
+ }
569
586
assertEquals (1 , env .getProjectList ().size ());
570
587
571
588
env .getProjects ().get (project ).setIndexed (false );
@@ -585,7 +602,9 @@ void testSetGet() throws Exception {
585
602
String [] projects = new String [] {"mercurial" , "git" };
586
603
587
604
for (String proj : projects ) {
588
- addProject (proj );
605
+ try (Response response = addProject (proj )) {
606
+ assertEquals (Response .Status .CREATED .getStatusCode (), response .getStatus ());
607
+ }
589
608
}
590
609
591
610
assertEquals (2 , env .getProjectList ().size ());
0 commit comments