Skip to content

Commit 686f515

Browse files
committed
refactor(discovery): Address codacy issues
1 parent 780ae68 commit 686f515

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

‎discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceIT.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ public void getConfigurationsWithFunkyNameIsSuccessful() {
614614
Configuration configuration = getTestConfiguration(DISCOVERY_TEST_CONFIG_FILE);
615615
createBuilder.configuration(configuration);
616616
createBuilder.name(uniqueConfigName);
617-
Configuration createResponse = createConfiguration(createBuilder.build());
617+
createConfiguration(createBuilder.build());
618618

619619
ListConfigurationsOptions.Builder getBuilder = new ListConfigurationsOptions.Builder(environmentId);
620620
getBuilder.name(uniqueConfigName);
@@ -920,15 +920,13 @@ public void updateDocumentIsSuccessful() {
920920
DocumentAccepted documentAccepted = createTestDocument("test_document", collectionId);
921921

922922
uniqueName = UUID.randomUUID().toString();
923-
Configuration testConfig = createTestConfig();
924923
String myDocumentJson = "{\"field\":\"value2\"}";
925924
InputStream documentStream = new ByteArrayInputStream(myDocumentJson.getBytes());
926925

927926
UpdateDocumentOptions.Builder updateBuilder = new UpdateDocumentOptions.Builder(environmentId, collectionId,
928927
documentAccepted.getDocumentId());
929928
updateBuilder.file(documentStream).fileContentType(HttpMediaType.APPLICATION_JSON);
930929
updateBuilder.filename("test_file");
931-
//updateBuilder.configurationId(testConfig.getConfigurationId());
932930
DocumentAccepted updateResponse = discovery.updateDocument(updateBuilder.build()).execute();
933931

934932
GetDocumentStatusOptions getOptions = new GetDocumentStatusOptions.Builder(environmentId, collectionId,
@@ -2010,7 +2008,7 @@ private synchronized String setupTestQueries(String collectionId) {
20102008
if (discovery.listTrainingData(builder.build()).execute().getQueries().size() > 0) {
20112009
return collectionId;
20122010
}
2013-
List<TrainingQuery> queriesAccepted = createTestQueries(collectionId, 10);
2011+
createTestQueries(collectionId, 10);
20142012

20152013
WaitFor.Condition collectionAvailable = new WaitForCollectionAvailable(environmentId, collectionId);
20162014
WaitFor.waitFor(collectionAvailable, 5, TimeUnit.SECONDS, 500);

‎discovery/src/test/java/com/ibm/watson/developer_cloud/discovery/v1/DiscoveryServiceTest.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,13 +623,12 @@ public void addDocumentFromInputStreamWithMediaTypeIsSuccessful() throws Interru
623623
@Test(expected = IllegalArgumentException.class)
624624
public void addDocumentWithoutRequiredParametersFails() {
625625
AddDocumentOptions options = new AddDocumentOptions.Builder(environmentId, collectionId).build();
626-
DocumentAccepted response = discoveryService.addDocument(options).execute();
626+
discoveryService.addDocument(options).execute();
627627
}
628628

629629
@Test
630630
public void addDocumentFromInputStreamWithFileNameAndMediaTypeIsSuccessful() throws InterruptedException {
631631
server.enqueue(jsonResponse(createDocResp));
632-
String fileName = "MyFileName";
633632
String myDocumentJson = "{\"field\":\"value\"}";
634633
JsonObject myMetadata = new JsonObject();
635634
myMetadata.add("foo", new JsonPrimitive("bar"));
@@ -673,7 +672,7 @@ public void updateDocumentIsSuccessful() throws InterruptedException {
673672
@Test(expected = IllegalArgumentException.class)
674673
public void updateDocumentWithoutRequiredParametersFails() {
675674
UpdateDocumentOptions options = new UpdateDocumentOptions.Builder(environmentId, collectionId, documentId).build();
676-
DocumentAccepted response = discoveryService.updateDocument(options).execute();
675+
discoveryService.updateDocument(options).execute();
677676
}
678677

679678
@Test
@@ -897,7 +896,7 @@ public void listFieldsIsSuccessful() throws InterruptedException {
897896
public void queryNoticesIsSuccessful() throws InterruptedException {
898897
server.enqueue(jsonResponse(queryNoticesResp));
899898
QueryNoticesOptions.Builder builder = new QueryNoticesOptions.Builder(environmentId, collectionId);
900-
QueryNoticesResponse response = discoveryService.queryNotices(builder.build()).execute();
899+
discoveryService.queryNotices(builder.build()).execute();
901900
RecordedRequest request = server.takeRequest();
902901

903902
assertEquals(Q5_PATH, request.getPath());
@@ -909,7 +908,7 @@ public void federatedQueryIsSuccessful() throws InterruptedException {
909908
server.enqueue(jsonResponse(queryResp));
910909
FederatedQueryOptions.Builder builder = new FederatedQueryOptions.Builder(environmentId, new ArrayList<>(Arrays
911910
.asList(collectionId)));
912-
QueryResponse response = discoveryService.federatedQuery(builder.build()).execute();
911+
discoveryService.federatedQuery(builder.build()).execute();
913912
RecordedRequest request = server.takeRequest();
914913

915914
assertEquals(Q3_PATH, request.getPath());
@@ -921,7 +920,7 @@ public void federatedQueryNoticesIsSuccessful() throws InterruptedException {
921920
server.enqueue(jsonResponse(queryNoticesResp));
922921
FederatedQueryNoticesOptions.Builder builder = new FederatedQueryNoticesOptions.Builder(environmentId,
923922
new ArrayList<>(Arrays.asList(collectionId)));
924-
QueryNoticesResponse response = discoveryService.federatedQueryNotices(builder.build()).execute();
923+
discoveryService.federatedQueryNotices(builder.build()).execute();
925924
RecordedRequest request = server.takeRequest();
926925

927926
assertEquals(Q4_PATH, request.getPath());

‎discovery/src/test/resources/discovery/update_env_resp.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"name": "Andrea_environment",
44
"description": "Dev environment for Andrea",
55
"created": "2016-12-13T17:42:23.067Z",
6-
"created": "2016-12-13T17:42:23.067Z",
76
"updated": "2016-12-14T08:22:05.231Z",
87
"status": "available",
98
"index_capacity": {

0 commit comments

Comments
 (0)