Skip to content

Commit c336bc0

Browse files
committed
test(assistant-v1): update unit tests and apply format
1 parent 4fdfb2f commit c336bc0

17 files changed

+1190
-1200
lines changed

assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceIT.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void testExample() throws InterruptedException {
131131
new ServiceCallback<MessageResponse>() {
132132
@Override
133133
public void onResponse(Response<MessageResponse> response) {
134-
/*System.out.println(response.getResult()); */
134+
/*System.out.println(response.getResult()); */
135135
}
136136

137137
@Override
@@ -1324,12 +1324,6 @@ public void testListWorkspaces() {
13241324

13251325
ListWorkspacesOptions listOptions = new ListWorkspacesOptions.Builder().build();
13261326
WorkspaceCollection response = service.listWorkspaces(listOptions).execute().getResult();
1327-
/** System.out.println(response);
1328-
DeleteWorkspaceOptions deleteOptions = new DeleteWorkspaceOptions.Builder("5b586426-c587-4775-950c-59b58db84b14").build();
1329-
service.deleteWorkspace(deleteOptions).execute();
1330-
DeleteWorkspaceOptions deleteOptions1 = new DeleteWorkspaceOptions.Builder("661d9f74-9d3a-4655-bee4-84e16bd25d00").build();
1331-
service.deleteWorkspace(deleteOptions1).execute(); **/
1332-
13331327
assertNotNull(response);
13341328
assertNotNull(response.getWorkspaces());
13351329
assertTrue(response.getWorkspaces().size() > 0);

assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantServiceTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ public void setUp() throws Exception {
6666
serviceUrl = getProperty("assistant.url");
6767
}
6868

69-
Assume.assumeFalse("ASSISTANT_APIKEY is not defined and config.properties doesn't have valid credentials.", apiKey == null);
69+
Assume.assumeFalse(
70+
"ASSISTANT_APIKEY is not defined and config.properties doesn't have valid credentials.",
71+
apiKey == null);
7072

7173
Authenticator authenticator = new IamAuthenticator(apiKey);
7274
service = new Assistant("2019-02-28", authenticator);

assistant/src/test/java/com/ibm/watson/assistant/v1/AssistantTest.java

+898-1,026
Large diffs are not rendered by default.

assistant/src/test/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputGenericDialogNodeOutputResponseTypeOptionTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testDialogNodeOutputGenericDialogNodeOutputResponseTypeOption() thro
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testDialogNodeOutputGenericDialogNodeOutputResponseTypeOption() thro
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

assistant/src/test/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testDialogNodeOutputOptionsElement() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testDialogNodeOutputOptionsElement() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

assistant/src/test/java/com/ibm/watson/assistant/v1/model/DialogNodeOutputOptionsElementValueTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testDialogNodeOutputOptionsElementValue() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testDialogNodeOutputOptionsElementValue() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

assistant/src/test/java/com/ibm/watson/assistant/v1/model/DialogSuggestionTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testDialogSuggestion() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testDialogSuggestion() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

assistant/src/test/java/com/ibm/watson/assistant/v1/model/DialogSuggestionValueTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testDialogSuggestionValue() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testDialogSuggestionValue() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

assistant/src/test/java/com/ibm/watson/assistant/v1/model/MessageOptionsTest.java

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testMessageOptions() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testMessageOptions() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));
@@ -286,7 +273,6 @@ public void testMessageOptions() throws Throwable {
286273
java.util.Arrays.asList(dialogNodeVisitedDetailsModel)))
287274
.logMessages(
288275
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)))
289-
.text(new java.util.ArrayList<String>(java.util.Arrays.asList("testString")))
290276
.generic(
291277
new java.util.ArrayList<RuntimeResponseGeneric>(
292278
java.util.Arrays.asList(runtimeResponseGenericModel)))
@@ -302,9 +288,6 @@ public void testMessageOptions() throws Throwable {
302288
assertEquals(
303289
outputDataModel.getLogMessages(),
304290
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)));
305-
assertEquals(
306-
outputDataModel.getText(),
307-
new java.util.ArrayList<String>(java.util.Arrays.asList("testString")));
308291
assertEquals(
309292
outputDataModel.getGeneric(),
310293
new java.util.ArrayList<RuntimeResponseGeneric>(

assistant/src/test/java/com/ibm/watson/assistant/v1/model/MessageRequestTest.java

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -131,12 +131,6 @@ public void testMessageRequest() throws Throwable {
131131
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
132132
.value("testString")
133133
.confidence(Double.valueOf("72.5"))
134-
.metadata(
135-
new java.util.HashMap<String, Object>() {
136-
{
137-
put("foo", "testString");
138-
}
139-
})
140134
.groups(
141135
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
142136
.interpretation(runtimeEntityInterpretationModel)
@@ -151,13 +145,6 @@ public void testMessageRequest() throws Throwable {
151145
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
152146
assertEquals(runtimeEntityModel.value(), "testString");
153147
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
154-
assertEquals(
155-
runtimeEntityModel.metadata(),
156-
new java.util.HashMap<String, Object>() {
157-
{
158-
put("foo", "testString");
159-
}
160-
});
161148
assertEquals(
162149
runtimeEntityModel.groups(),
163150
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));
@@ -286,7 +273,6 @@ public void testMessageRequest() throws Throwable {
286273
java.util.Arrays.asList(dialogNodeVisitedDetailsModel)))
287274
.logMessages(
288275
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)))
289-
.text(new java.util.ArrayList<String>(java.util.Arrays.asList("testString")))
290276
.generic(
291277
new java.util.ArrayList<RuntimeResponseGeneric>(
292278
java.util.Arrays.asList(runtimeResponseGenericModel)))
@@ -302,9 +288,6 @@ public void testMessageRequest() throws Throwable {
302288
assertEquals(
303289
outputDataModel.getLogMessages(),
304290
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)));
305-
assertEquals(
306-
outputDataModel.getText(),
307-
new java.util.ArrayList<String>(java.util.Arrays.asList("testString")));
308291
assertEquals(
309292
outputDataModel.getGeneric(),
310293
new java.util.ArrayList<RuntimeResponseGeneric>(

assistant/src/test/java/com/ibm/watson/assistant/v1/model/OutputDataTest.java

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2021.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -158,12 +158,6 @@ public void testOutputData() throws Throwable {
158158
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
159159
.value("testString")
160160
.confidence(Double.valueOf("72.5"))
161-
.metadata(
162-
new java.util.HashMap<String, Object>() {
163-
{
164-
put("foo", "testString");
165-
}
166-
})
167161
.groups(
168162
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
169163
.interpretation(runtimeEntityInterpretationModel)
@@ -178,13 +172,6 @@ public void testOutputData() throws Throwable {
178172
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
179173
assertEquals(runtimeEntityModel.value(), "testString");
180174
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
181-
assertEquals(
182-
runtimeEntityModel.metadata(),
183-
new java.util.HashMap<String, Object>() {
184-
{
185-
put("foo", "testString");
186-
}
187-
});
188175
assertEquals(
189176
runtimeEntityModel.groups(),
190177
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));
@@ -258,7 +245,6 @@ public void testOutputData() throws Throwable {
258245
java.util.Arrays.asList(dialogNodeVisitedDetailsModel)))
259246
.logMessages(
260247
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)))
261-
.text(new java.util.ArrayList<String>(java.util.Arrays.asList("testString")))
262248
.generic(
263249
new java.util.ArrayList<RuntimeResponseGeneric>(
264250
java.util.Arrays.asList(runtimeResponseGenericModel)))
@@ -274,9 +260,6 @@ public void testOutputData() throws Throwable {
274260
assertEquals(
275261
outputDataModel.getLogMessages(),
276262
new java.util.ArrayList<LogMessage>(java.util.Arrays.asList(logMessageModel)));
277-
assertEquals(
278-
outputDataModel.getText(),
279-
new java.util.ArrayList<String>(java.util.Arrays.asList("testString")));
280263
assertEquals(
281264
outputDataModel.getGeneric(),
282265
new java.util.ArrayList<RuntimeResponseGeneric>(

assistant/src/test/java/com/ibm/watson/assistant/v1/model/RuntimeEntityTest.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
55
* the License. You may obtain a copy of the License at
@@ -114,12 +114,6 @@ public void testRuntimeEntity() throws Throwable {
114114
.location(new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))))
115115
.value("testString")
116116
.confidence(Double.valueOf("72.5"))
117-
.metadata(
118-
new java.util.HashMap<String, Object>() {
119-
{
120-
put("foo", "testString");
121-
}
122-
})
123117
.groups(
124118
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)))
125119
.interpretation(runtimeEntityInterpretationModel)
@@ -134,13 +128,6 @@ public void testRuntimeEntity() throws Throwable {
134128
new java.util.ArrayList<Long>(java.util.Arrays.asList(Long.valueOf("26"))));
135129
assertEquals(runtimeEntityModel.value(), "testString");
136130
assertEquals(runtimeEntityModel.confidence(), Double.valueOf("72.5"));
137-
assertEquals(
138-
runtimeEntityModel.metadata(),
139-
new java.util.HashMap<String, Object>() {
140-
{
141-
put("foo", "testString");
142-
}
143-
});
144131
assertEquals(
145132
runtimeEntityModel.groups(),
146133
new java.util.ArrayList<CaptureGroup>(java.util.Arrays.asList(captureGroupModel)));

0 commit comments

Comments
 (0)