Skip to content

Commit 6b740f5

Browse files
jeff-arnapaparazzi0329
authored andcommitted
test(generated unit tests): update unit tests
1 parent 0a7058b commit 6b740f5

File tree

137 files changed

+4302
-3371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+4302
-3371
lines changed

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

Lines changed: 160 additions & 480 deletions
Large diffs are not rendered by default.

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

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020.
2+
* (C) Copyright IBM Corp. 2023.
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
@@ -38,23 +38,13 @@ public void testContext() throws Throwable {
3838
Context contextModel =
3939
new Context.Builder()
4040
.conversationId("testString")
41-
.system(
42-
new java.util.HashMap<String, Object>() {
43-
{
44-
put("foo", "testString");
45-
}
46-
})
41+
.system(java.util.Collections.singletonMap("anyKey", "anyValue"))
4742
.metadata(messageContextMetadataModel)
4843
.add("foo", "testString")
4944
.build();
5045
assertEquals(contextModel.getConversationId(), "testString");
5146
assertEquals(
52-
contextModel.getSystem(),
53-
new java.util.HashMap<String, Object>() {
54-
{
55-
put("foo", "testString");
56-
}
57-
});
47+
contextModel.getSystem(), java.util.Collections.singletonMap("anyKey", "anyValue"));
5848
assertEquals(contextModel.getMetadata(), messageContextMetadataModel);
5949
assertEquals(contextModel.get("foo"), "testString");
6050

@@ -63,6 +53,9 @@ public void testContext() throws Throwable {
6353
Context contextModelNew = TestUtilities.deserialize(json, Context.class);
6454
assertTrue(contextModelNew instanceof Context);
6555
assertEquals(contextModelNew.getConversationId(), "testString");
56+
assertEquals(
57+
contextModelNew.getSystem().toString(),
58+
java.util.Collections.singletonMap("anyKey", "anyValue").toString());
6659
assertEquals(contextModelNew.getMetadata().toString(), messageContextMetadataModel.toString());
6760
assertEquals(contextModelNew.get("foo"), "testString");
6861
}

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

Lines changed: 29 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
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
@@ -20,7 +20,6 @@
2020
import java.io.InputStream;
2121
import java.util.HashMap;
2222
import java.util.List;
23-
import java.util.Map;
2423
import org.testng.annotations.Test;
2524

2625
/** Unit test class for the CreateDialogNodeOptions model. */
@@ -31,40 +30,31 @@ public class CreateDialogNodeOptionsTest {
3130

3231
@Test
3332
public void testCreateDialogNodeOptions() throws Throwable {
33+
DialogNodeOutputTextValuesElement dialogNodeOutputTextValuesElementModel =
34+
new DialogNodeOutputTextValuesElement.Builder().text("testString").build();
35+
assertEquals(dialogNodeOutputTextValuesElementModel.text(), "testString");
36+
3437
ResponseGenericChannel responseGenericChannelModel =
3538
new ResponseGenericChannel.Builder().channel("chat").build();
3639
assertEquals(responseGenericChannelModel.channel(), "chat");
3740

38-
DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo dialogNodeOutputGenericModel =
39-
new DialogNodeOutputGenericDialogNodeOutputResponseTypeVideo.Builder()
40-
.responseType("video")
41-
.source("testString")
42-
.title("testString")
43-
.description("testString")
41+
DialogNodeOutputGenericDialogNodeOutputResponseTypeText dialogNodeOutputGenericModel =
42+
new DialogNodeOutputGenericDialogNodeOutputResponseTypeText.Builder()
43+
.responseType("text")
44+
.values(java.util.Arrays.asList(dialogNodeOutputTextValuesElementModel))
45+
.selectionPolicy("sequential")
46+
.delimiter("\n")
4447
.channels(java.util.Arrays.asList(responseGenericChannelModel))
45-
.channelOptions(
46-
new java.util.HashMap<String, Object>() {
47-
{
48-
put("foo", "testString");
49-
}
50-
})
51-
.altText("testString")
5248
.build();
53-
assertEquals(dialogNodeOutputGenericModel.responseType(), "video");
54-
assertEquals(dialogNodeOutputGenericModel.source(), "testString");
55-
assertEquals(dialogNodeOutputGenericModel.title(), "testString");
56-
assertEquals(dialogNodeOutputGenericModel.description(), "testString");
49+
assertEquals(dialogNodeOutputGenericModel.responseType(), "text");
50+
assertEquals(
51+
dialogNodeOutputGenericModel.values(),
52+
java.util.Arrays.asList(dialogNodeOutputTextValuesElementModel));
53+
assertEquals(dialogNodeOutputGenericModel.selectionPolicy(), "sequential");
54+
assertEquals(dialogNodeOutputGenericModel.delimiter(), "\n");
5755
assertEquals(
5856
dialogNodeOutputGenericModel.channels(),
5957
java.util.Arrays.asList(responseGenericChannelModel));
60-
assertEquals(
61-
dialogNodeOutputGenericModel.channelOptions(),
62-
new java.util.HashMap<String, Object>() {
63-
{
64-
put("foo", "testString");
65-
}
66-
});
67-
assertEquals(dialogNodeOutputGenericModel.altText(), "testString");
6858

6959
DialogNodeOutputModifiers dialogNodeOutputModifiersModel =
7060
new DialogNodeOutputModifiers.Builder().overwrite(true).build();
@@ -74,67 +64,31 @@ public void testCreateDialogNodeOptions() throws Throwable {
7464
new DialogNodeOutput.Builder()
7565
.generic(java.util.Arrays.asList(dialogNodeOutputGenericModel))
7666
.integrations(
77-
new java.util.HashMap<String, Map<String, Object>>() {
78-
{
79-
put(
80-
"foo",
81-
new java.util.HashMap<String, Object>() {
82-
{
83-
put("foo", "testString");
84-
}
85-
});
86-
}
87-
})
67+
java.util.Collections.singletonMap(
68+
"foo", java.util.Collections.singletonMap("anyKey", "anyValue")))
8869
.modifiers(dialogNodeOutputModifiersModel)
8970
.add("foo", "testString")
9071
.build();
9172
assertEquals(
9273
dialogNodeOutputModel.getGeneric(), java.util.Arrays.asList(dialogNodeOutputGenericModel));
9374
assertEquals(
9475
dialogNodeOutputModel.getIntegrations(),
95-
new java.util.HashMap<String, Map<String, Object>>() {
96-
{
97-
put(
98-
"foo",
99-
new java.util.HashMap<String, Object>() {
100-
{
101-
put("foo", "testString");
102-
}
103-
});
104-
}
105-
});
76+
java.util.Collections.singletonMap(
77+
"foo", java.util.Collections.singletonMap("anyKey", "anyValue")));
10678
assertEquals(dialogNodeOutputModel.getModifiers(), dialogNodeOutputModifiersModel);
10779
assertEquals(dialogNodeOutputModel.get("foo"), "testString");
10880

10981
DialogNodeContext dialogNodeContextModel =
11082
new DialogNodeContext.Builder()
11183
.integrations(
112-
new java.util.HashMap<String, Map<String, Object>>() {
113-
{
114-
put(
115-
"foo",
116-
new java.util.HashMap<String, Object>() {
117-
{
118-
put("foo", "testString");
119-
}
120-
});
121-
}
122-
})
84+
java.util.Collections.singletonMap(
85+
"foo", java.util.Collections.singletonMap("anyKey", "anyValue")))
12386
.add("foo", "testString")
12487
.build();
12588
assertEquals(
12689
dialogNodeContextModel.getIntegrations(),
127-
new java.util.HashMap<String, Map<String, Object>>() {
128-
{
129-
put(
130-
"foo",
131-
new java.util.HashMap<String, Object>() {
132-
{
133-
put("foo", "testString");
134-
}
135-
});
136-
}
137-
});
90+
java.util.Collections.singletonMap(
91+
"foo", java.util.Collections.singletonMap("anyKey", "anyValue")));
13892
assertEquals(dialogNodeContextModel.get("foo"), "testString");
13993

14094
DialogNodeNextStep dialogNodeNextStepModel =
@@ -151,24 +105,15 @@ public void testCreateDialogNodeOptions() throws Throwable {
151105
new DialogNodeAction.Builder()
152106
.name("testString")
153107
.type("client")
154-
.parameters(
155-
new java.util.HashMap<String, Object>() {
156-
{
157-
put("foo", "testString");
158-
}
159-
})
108+
.parameters(java.util.Collections.singletonMap("anyKey", "anyValue"))
160109
.resultVariable("testString")
161110
.credentials("testString")
162111
.build();
163112
assertEquals(dialogNodeActionModel.name(), "testString");
164113
assertEquals(dialogNodeActionModel.type(), "client");
165114
assertEquals(
166115
dialogNodeActionModel.parameters(),
167-
new java.util.HashMap<String, Object>() {
168-
{
169-
put("foo", "testString");
170-
}
171-
});
116+
java.util.Collections.singletonMap("anyKey", "anyValue"));
172117
assertEquals(dialogNodeActionModel.resultVariable(), "testString");
173118
assertEquals(dialogNodeActionModel.credentials(), "testString");
174119

@@ -182,12 +127,7 @@ public void testCreateDialogNodeOptions() throws Throwable {
182127
.previousSibling("testString")
183128
.output(dialogNodeOutputModel)
184129
.context(dialogNodeContextModel)
185-
.metadata(
186-
new java.util.HashMap<String, Object>() {
187-
{
188-
put("foo", "testString");
189-
}
190-
})
130+
.metadata(java.util.Collections.singletonMap("anyKey", "anyValue"))
191131
.nextStep(dialogNodeNextStepModel)
192132
.title("testString")
193133
.type("standard")
@@ -211,11 +151,7 @@ public void testCreateDialogNodeOptions() throws Throwable {
211151
assertEquals(createDialogNodeOptionsModel.context(), dialogNodeContextModel);
212152
assertEquals(
213153
createDialogNodeOptionsModel.metadata(),
214-
new java.util.HashMap<String, Object>() {
215-
{
216-
put("foo", "testString");
217-
}
218-
});
154+
java.util.Collections.singletonMap("anyKey", "anyValue"));
219155
assertEquals(createDialogNodeOptionsModel.nextStep(), dialogNodeNextStepModel);
220156
assertEquals(createDialogNodeOptionsModel.title(), "testString");
221157
assertEquals(createDialogNodeOptionsModel.type(), "standard");

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

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
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
@@ -33,24 +33,14 @@ public void testCreateEntityOptions() throws Throwable {
3333
CreateValue createValueModel =
3434
new CreateValue.Builder()
3535
.value("testString")
36-
.metadata(
37-
new java.util.HashMap<String, Object>() {
38-
{
39-
put("foo", "testString");
40-
}
41-
})
36+
.metadata(java.util.Collections.singletonMap("anyKey", "anyValue"))
4237
.type("synonyms")
4338
.synonyms(java.util.Arrays.asList("testString"))
4439
.patterns(java.util.Arrays.asList("testString"))
4540
.build();
4641
assertEquals(createValueModel.value(), "testString");
4742
assertEquals(
48-
createValueModel.metadata(),
49-
new java.util.HashMap<String, Object>() {
50-
{
51-
put("foo", "testString");
52-
}
53-
});
43+
createValueModel.metadata(), java.util.Collections.singletonMap("anyKey", "anyValue"));
5444
assertEquals(createValueModel.type(), "synonyms");
5545
assertEquals(createValueModel.synonyms(), java.util.Arrays.asList("testString"));
5646
assertEquals(createValueModel.patterns(), java.util.Arrays.asList("testString"));
@@ -60,12 +50,7 @@ public void testCreateEntityOptions() throws Throwable {
6050
.workspaceId("testString")
6151
.entity("testString")
6252
.description("testString")
63-
.metadata(
64-
new java.util.HashMap<String, Object>() {
65-
{
66-
put("foo", "testString");
67-
}
68-
})
53+
.metadata(java.util.Collections.singletonMap("anyKey", "anyValue"))
6954
.fuzzyMatch(true)
7055
.values(java.util.Arrays.asList(createValueModel))
7156
.includeAudit(false)
@@ -75,11 +60,7 @@ public void testCreateEntityOptions() throws Throwable {
7560
assertEquals(createEntityOptionsModel.description(), "testString");
7661
assertEquals(
7762
createEntityOptionsModel.metadata(),
78-
new java.util.HashMap<String, Object>() {
79-
{
80-
put("foo", "testString");
81-
}
82-
});
63+
java.util.Collections.singletonMap("anyKey", "anyValue"));
8364
assertEquals(createEntityOptionsModel.fuzzyMatch(), Boolean.valueOf(true));
8465
assertEquals(createEntityOptionsModel.values(), java.util.Arrays.asList(createValueModel));
8566
assertEquals(createEntityOptionsModel.includeAudit(), Boolean.valueOf(false));

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

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* (C) Copyright IBM Corp. 2020, 2022.
2+
* (C) Copyright IBM Corp. 2023.
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
@@ -33,24 +33,14 @@ public void testCreateEntity() throws Throwable {
3333
CreateValue createValueModel =
3434
new CreateValue.Builder()
3535
.value("testString")
36-
.metadata(
37-
new java.util.HashMap<String, Object>() {
38-
{
39-
put("foo", "testString");
40-
}
41-
})
36+
.metadata(java.util.Collections.singletonMap("anyKey", "anyValue"))
4237
.type("synonyms")
4338
.synonyms(java.util.Arrays.asList("testString"))
4439
.patterns(java.util.Arrays.asList("testString"))
4540
.build();
4641
assertEquals(createValueModel.value(), "testString");
4742
assertEquals(
48-
createValueModel.metadata(),
49-
new java.util.HashMap<String, Object>() {
50-
{
51-
put("foo", "testString");
52-
}
53-
});
43+
createValueModel.metadata(), java.util.Collections.singletonMap("anyKey", "anyValue"));
5444
assertEquals(createValueModel.type(), "synonyms");
5545
assertEquals(createValueModel.synonyms(), java.util.Arrays.asList("testString"));
5646
assertEquals(createValueModel.patterns(), java.util.Arrays.asList("testString"));
@@ -59,24 +49,14 @@ public void testCreateEntity() throws Throwable {
5949
new CreateEntity.Builder()
6050
.entity("testString")
6151
.description("testString")
62-
.metadata(
63-
new java.util.HashMap<String, Object>() {
64-
{
65-
put("foo", "testString");
66-
}
67-
})
52+
.metadata(java.util.Collections.singletonMap("anyKey", "anyValue"))
6853
.fuzzyMatch(true)
6954
.values(java.util.Arrays.asList(createValueModel))
7055
.build();
7156
assertEquals(createEntityModel.entity(), "testString");
7257
assertEquals(createEntityModel.description(), "testString");
7358
assertEquals(
74-
createEntityModel.metadata(),
75-
new java.util.HashMap<String, Object>() {
76-
{
77-
put("foo", "testString");
78-
}
79-
});
59+
createEntityModel.metadata(), java.util.Collections.singletonMap("anyKey", "anyValue"));
8060
assertEquals(createEntityModel.fuzzyMatch(), Boolean.valueOf(true));
8161
assertEquals(createEntityModel.values(), java.util.Arrays.asList(createValueModel));
8262

@@ -86,6 +66,9 @@ public void testCreateEntity() throws Throwable {
8666
assertTrue(createEntityModelNew instanceof CreateEntity);
8767
assertEquals(createEntityModelNew.entity(), "testString");
8868
assertEquals(createEntityModelNew.description(), "testString");
69+
assertEquals(
70+
createEntityModelNew.metadata().toString(),
71+
java.util.Collections.singletonMap("anyKey", "anyValue").toString());
8972
assertEquals(createEntityModelNew.fuzzyMatch(), Boolean.valueOf(true));
9073
}
9174

0 commit comments

Comments
 (0)