@@ -179,20 +179,22 @@ public void cleanup() {
179179 }
180180 }
181181
182- ListCollectionsOptions listCollectionsOptions = new ListCollectionsOptions .Builder ()
183- .environmentId (environmentId )
184- .build ();
185- ListCollectionsResponse response = discovery .listCollections (listCollectionsOptions ).execute ().getResult ();
186- for (Collection collection : response .getCollections ()){
187- if (collection .getName ().matches ("java-sdk-.*collection" ) ||
188- collection .getName ().matches ("my_watson_developer_cloud_collection.*" ) ||
189- collection .getName ().matches ("tokenization-dict-testing-collection.*" )) {
190- DeleteCollectionOptions deleteCollectionOptions = new DeleteCollectionOptions .Builder ()
182+ ListCollectionsOptions listCollectionsOptions =
183+ new ListCollectionsOptions .Builder ().environmentId (environmentId ).build ();
184+ ListCollectionsResponse response =
185+ discovery .listCollections (listCollectionsOptions ).execute ().getResult ();
186+ for (Collection collection : response .getCollections ()) {
187+ if (collection .getName ().matches ("java-sdk-.*collection" )
188+ || collection .getName ().matches ("my_watson_developer_cloud_collection.*" )
189+ || collection .getName ().matches ("tokenization-dict-testing-collection.*" )) {
190+ DeleteCollectionOptions deleteCollectionOptions =
191+ new DeleteCollectionOptions .Builder ()
191192 .collectionId (collection .getCollectionId ())
192193 .environmentId (environmentId )
193194 .build ();
194195 try {
195- DeleteCollectionResponse deleteCollectionResponse = discovery .deleteCollection (deleteCollectionOptions ).execute ().getResult ();
196+ DeleteCollectionResponse deleteCollectionResponse =
197+ discovery .deleteCollection (deleteCollectionOptions ).execute ().getResult ();
196198 } catch (NotFoundException ex ) {
197199 System .out .println ("deleteCollection failed. Collection " + collectionId + " not found" );
198200 }
0 commit comments