Skip to content

Commit b36e0c3

Browse files
committed
test(Discovery): Just check for not null on date values
1 parent 53f5d74 commit b36e0c3

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
import com.ibm.watson.developer_cloud.discovery.v1.model.NormalizationOperation;
8686
import com.ibm.watson.developer_cloud.discovery.v1.model.NormalizationOperation.Operation;
8787
import com.ibm.watson.developer_cloud.discovery.v1.model.QueryAggregation;
88-
import com.ibm.watson.developer_cloud.discovery.v1.model.QueryLogOptions;
8988
import com.ibm.watson.developer_cloud.discovery.v1.model.QueryNoticesOptions;
9089
import com.ibm.watson.developer_cloud.discovery.v1.model.QueryNoticesResponse;
9190
import com.ibm.watson.developer_cloud.discovery.v1.model.QueryOptions;

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

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ public void updateCredentialsIsSuccessful() throws InterruptedException {
11451145
public void createEventIsSuccessful() throws InterruptedException {
11461146
server.enqueue(jsonResponse(createEventResp));
11471147

1148-
String dateString = "Wed Dec 14 12:32:41 EST 2016";
11491148
Long displayRank = 1L;
11501149
String sessionToken = "mock_session_token";
11511150

@@ -1170,7 +1169,7 @@ public void createEventIsSuccessful() throws InterruptedException {
11701169
assertEquals(environmentId, response.getData().getEnvironmentId());
11711170
assertEquals(collectionId, response.getData().getCollectionId());
11721171
assertEquals(documentId, response.getData().getDocumentId());
1173-
assertEquals(dateString, String.valueOf(response.getData().getClientTimestamp()));
1172+
assertNotNull(response.getData().getClientTimestamp());
11741173
assertEquals(displayRank, response.getData().getDisplayRank());
11751174
assertEquals(queryId, response.getData().getQueryId());
11761175
assertEquals(sessionToken, response.getData().getSessionToken());
@@ -1182,7 +1181,6 @@ public void getMetricsEventRateIsSuccessful() throws InterruptedException {
11821181

11831182
String interval = "1d";
11841183
Long key = 1533513600000L;
1185-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
11861184
Double eventRate = 0.0;
11871185

11881186
GetMetricsEventRateOptions options = new GetMetricsEventRateOptions.Builder()
@@ -1200,7 +1198,7 @@ public void getMetricsEventRateIsSuccessful() throws InterruptedException {
12001198
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
12011199
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
12021200
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1203-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1201+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
12041202
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
12051203
}
12061204

@@ -1210,7 +1208,6 @@ public void getMetricsEventRateNoArgsIsSuccessful() throws InterruptedException
12101208

12111209
String interval = "1d";
12121210
Long key = 1533513600000L;
1213-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
12141211
Double eventRate = 0.0;
12151212

12161213
MetricResponse response = discoveryService.getMetricsEventRate().execute();
@@ -1223,7 +1220,7 @@ public void getMetricsEventRateNoArgsIsSuccessful() throws InterruptedException
12231220
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
12241221
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
12251222
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1226-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1223+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
12271224
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
12281225
}
12291226

@@ -1233,7 +1230,6 @@ public void getMetricsQueryIsSuccessful() throws InterruptedException {
12331230

12341231
String interval = "1d";
12351232
Long key = 1533513600000L;
1236-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
12371233
Double eventRate = 0.0;
12381234

12391235
GetMetricsQueryOptions options = new GetMetricsQueryOptions.Builder()
@@ -1251,7 +1247,7 @@ public void getMetricsQueryIsSuccessful() throws InterruptedException {
12511247
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
12521248
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
12531249
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1254-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1250+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
12551251
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
12561252
}
12571253

@@ -1261,7 +1257,6 @@ public void getMetricsQueryNoArgsIsSuccessful() throws InterruptedException {
12611257

12621258
String interval = "1d";
12631259
Long key = 1533513600000L;
1264-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
12651260
Double eventRate = 0.0;
12661261

12671262
MetricResponse response = discoveryService.getMetricsQuery().execute();
@@ -1274,7 +1269,7 @@ public void getMetricsQueryNoArgsIsSuccessful() throws InterruptedException {
12741269
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
12751270
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
12761271
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1277-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1272+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
12781273
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
12791274
}
12801275

@@ -1284,7 +1279,6 @@ public void getMetricsQueryEventIsSuccessful() throws InterruptedException {
12841279

12851280
String interval = "1d";
12861281
Long key = 1533513600000L;
1287-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
12881282
Double eventRate = 0.0;
12891283

12901284
GetMetricsQueryEventOptions options = new GetMetricsQueryEventOptions.Builder()
@@ -1302,7 +1296,7 @@ public void getMetricsQueryEventIsSuccessful() throws InterruptedException {
13021296
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
13031297
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
13041298
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1305-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1299+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
13061300
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
13071301
}
13081302

@@ -1312,7 +1306,6 @@ public void getMetricsQueryEventNoArgsIsSuccessful() throws InterruptedException
13121306

13131307
String interval = "1d";
13141308
Long key = 1533513600000L;
1315-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
13161309
Double eventRate = 0.0;
13171310

13181311
MetricResponse response = discoveryService.getMetricsQueryEvent().execute();
@@ -1325,7 +1318,7 @@ public void getMetricsQueryEventNoArgsIsSuccessful() throws InterruptedException
13251318
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
13261319
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
13271320
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1328-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1321+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
13291322
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
13301323
}
13311324

@@ -1335,7 +1328,6 @@ public void getMetricsQueryNoResultsIsSuccessful() throws InterruptedException {
13351328

13361329
String interval = "1d";
13371330
Long key = 1533513600000L;
1338-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
13391331
Double eventRate = 0.0;
13401332

13411333
GetMetricsQueryNoResultsOptions options = new GetMetricsQueryNoResultsOptions.Builder()
@@ -1353,7 +1345,7 @@ public void getMetricsQueryNoResultsIsSuccessful() throws InterruptedException {
13531345
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
13541346
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
13551347
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1356-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1348+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
13571349
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
13581350
}
13591351

@@ -1363,7 +1355,6 @@ public void getMetricsQueryNoResultsNoArgsIsSuccessful() throws InterruptedExcep
13631355

13641356
String interval = "1d";
13651357
Long key = 1533513600000L;
1366-
String keyAsString = "Sun Aug 05 20:00:00 EDT 2018";
13671358
Double eventRate = 0.0;
13681359

13691360
MetricResponse response = discoveryService.getMetricsQueryNoResults().execute();
@@ -1376,7 +1367,7 @@ public void getMetricsQueryNoResultsNoArgsIsSuccessful() throws InterruptedExcep
13761367
assertEquals(CreateEventOptions.Type.CLICK, response.getAggregations().get(0).getEventType());
13771368
assertTrue(!response.getAggregations().get(0).getResults().isEmpty());
13781369
assertEquals(key, response.getAggregations().get(0).getResults().get(0).getKey());
1379-
assertEquals(keyAsString, String.valueOf(response.getAggregations().get(0).getResults().get(0).getKeyAsString()));
1370+
assertNotNull(response.getAggregations().get(0).getResults().get(0).getKeyAsString());
13801371
assertEquals(eventRate, response.getAggregations().get(0).getResults().get(0).getEventRate());
13811372
}
13821373

@@ -1442,7 +1433,6 @@ public void queryLogIsSuccessful() throws InterruptedException {
14421433
String sessionToken = "mock_session_token";
14431434
String eventType = "query";
14441435
Long resultCount = 0L;
1445-
String dateString = "Mon Jul 16 18:27:26 EDT 2018";
14461436

14471437
QueryLogOptions options = new QueryLogOptions.Builder()
14481438
.sort(sortList)
@@ -1461,7 +1451,7 @@ public void queryLogIsSuccessful() throws InterruptedException {
14611451
assertTrue(!response.getResults().isEmpty());
14621452
assertEquals(environmentId, response.getResults().get(0).getEnvironmentId());
14631453
assertEquals(customerId, response.getResults().get(0).getCustomerId());
1464-
assertEquals(dateString, String.valueOf(response.getResults().get(0).getCreatedTimestamp()));
1454+
assertNotNull(response.getResults().get(0).getCreatedTimestamp());
14651455
assertEquals(queryId, response.getResults().get(0).getQueryId());
14661456
assertEquals(sessionToken, response.getResults().get(0).getSessionToken());
14671457
assertEquals(eventType, response.getResults().get(0).getEventType());
@@ -1480,7 +1470,6 @@ public void queryLogNoArgsIsSuccessful() throws InterruptedException {
14801470
String sessionToken = "mock_session_token";
14811471
String eventType = "query";
14821472
Long resultCount = 0L;
1483-
String dateString = "Mon Jul 16 18:27:26 EDT 2018";
14841473

14851474
LogQueryResponse response = discoveryService.queryLog().execute();
14861475
RecordedRequest request = server.takeRequest();
@@ -1491,7 +1480,7 @@ public void queryLogNoArgsIsSuccessful() throws InterruptedException {
14911480
assertTrue(!response.getResults().isEmpty());
14921481
assertEquals(environmentId, response.getResults().get(0).getEnvironmentId());
14931482
assertEquals(customerId, response.getResults().get(0).getCustomerId());
1494-
assertEquals(dateString, String.valueOf(response.getResults().get(0).getCreatedTimestamp()));
1483+
assertNotNull(response.getResults().get(0).getCreatedTimestamp());
14951484
assertEquals(queryId, response.getResults().get(0).getQueryId());
14961485
assertEquals(sessionToken, response.getResults().get(0).getSessionToken());
14971486
assertEquals(eventType, response.getResults().get(0).getEventType());

0 commit comments

Comments
 (0)