Skip to content

Commit faea1a2

Browse files
test(assistantv2): update unit tests for new methods
1 parent 2f164cd commit faea1a2

18 files changed

+1031
-3
lines changed

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

Lines changed: 321 additions & 3 deletions
Large diffs are not rendered by default.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the DeployReleaseOptions model. */
26+
public class DeployReleaseOptionsTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testDeployReleaseOptions() throws Throwable {
33+
DeployReleaseOptions deployReleaseOptionsModel =
34+
new DeployReleaseOptions.Builder()
35+
.assistantId("testString")
36+
.release("testString")
37+
.environmentId("testString")
38+
.includeAudit(false)
39+
.build();
40+
assertEquals(deployReleaseOptionsModel.assistantId(), "testString");
41+
assertEquals(deployReleaseOptionsModel.release(), "testString");
42+
assertEquals(deployReleaseOptionsModel.environmentId(), "testString");
43+
assertEquals(deployReleaseOptionsModel.includeAudit(), Boolean.valueOf(false));
44+
}
45+
46+
@Test(expectedExceptions = IllegalArgumentException.class)
47+
public void testDeployReleaseOptionsError() throws Throwable {
48+
new DeployReleaseOptions.Builder().build();
49+
}
50+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the EnvironmentCollection model. */
26+
public class EnvironmentCollectionTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testEnvironmentCollection() throws Throwable {
33+
EnvironmentCollection environmentCollectionModel = new EnvironmentCollection();
34+
assertNull(environmentCollectionModel.getEnvironments());
35+
assertNull(environmentCollectionModel.getPagination());
36+
}
37+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the EnvironmentOrchestration model. */
26+
public class EnvironmentOrchestrationTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testEnvironmentOrchestration() throws Throwable {
33+
EnvironmentOrchestration environmentOrchestrationModel = new EnvironmentOrchestration();
34+
assertNull(environmentOrchestrationModel.isSearchSkillFallback());
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the EnvironmentReference model. */
26+
public class EnvironmentReferenceTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testEnvironmentReference() throws Throwable {
33+
EnvironmentReference environmentReferenceModel = new EnvironmentReference();
34+
assertNull(environmentReferenceModel.getName());
35+
}
36+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the EnvironmentReleaseReference model. */
26+
public class EnvironmentReleaseReferenceTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testEnvironmentReleaseReference() throws Throwable {
33+
EnvironmentReleaseReference environmentReleaseReferenceModel =
34+
new EnvironmentReleaseReference();
35+
assertNull(environmentReleaseReferenceModel.getRelease());
36+
}
37+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the Environment model. */
26+
public class EnvironmentTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testEnvironment() throws Throwable {
33+
Environment environmentModel = new Environment();
34+
assertNull(environmentModel.getName());
35+
assertNull(environmentModel.getDescription());
36+
assertNull(environmentModel.getLanguage());
37+
assertNull(environmentModel.getReleaseReference());
38+
assertNull(environmentModel.getOrchestration());
39+
assertNull(environmentModel.getSessionTimeout());
40+
assertNull(environmentModel.getIntegrationReferences());
41+
assertNull(environmentModel.getSkillReferences());
42+
}
43+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the GetEnvironmentOptions model. */
26+
public class GetEnvironmentOptionsTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testGetEnvironmentOptions() throws Throwable {
33+
GetEnvironmentOptions getEnvironmentOptionsModel =
34+
new GetEnvironmentOptions.Builder()
35+
.assistantId("testString")
36+
.environmentId("testString")
37+
.includeAudit(false)
38+
.build();
39+
assertEquals(getEnvironmentOptionsModel.assistantId(), "testString");
40+
assertEquals(getEnvironmentOptionsModel.environmentId(), "testString");
41+
assertEquals(getEnvironmentOptionsModel.includeAudit(), Boolean.valueOf(false));
42+
}
43+
44+
@Test(expectedExceptions = IllegalArgumentException.class)
45+
public void testGetEnvironmentOptionsError() throws Throwable {
46+
new GetEnvironmentOptions.Builder().build();
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the GetReleaseOptions model. */
26+
public class GetReleaseOptionsTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testGetReleaseOptions() throws Throwable {
33+
GetReleaseOptions getReleaseOptionsModel =
34+
new GetReleaseOptions.Builder()
35+
.assistantId("testString")
36+
.release("testString")
37+
.includeAudit(false)
38+
.build();
39+
assertEquals(getReleaseOptionsModel.assistantId(), "testString");
40+
assertEquals(getReleaseOptionsModel.release(), "testString");
41+
assertEquals(getReleaseOptionsModel.includeAudit(), Boolean.valueOf(false));
42+
}
43+
44+
@Test(expectedExceptions = IllegalArgumentException.class)
45+
public void testGetReleaseOptionsError() throws Throwable {
46+
new GetReleaseOptions.Builder().build();
47+
}
48+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* (C) Copyright IBM Corp. 2022.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package com.ibm.watson.assistant.v2.model;
15+
16+
import static org.testng.Assert.*;
17+
18+
import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
19+
import com.ibm.watson.assistant.v2.utils.TestUtilities;
20+
import java.io.InputStream;
21+
import java.util.HashMap;
22+
import java.util.List;
23+
import org.testng.annotations.Test;
24+
25+
/** Unit test class for the IntegrationReference model. */
26+
public class IntegrationReferenceTest {
27+
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
28+
final List<FileWithMetadata> mockListFileWithMetadata =
29+
TestUtilities.creatMockListFileWithMetadata();
30+
31+
@Test
32+
public void testIntegrationReference() throws Throwable {
33+
IntegrationReference integrationReferenceModel = new IntegrationReference();
34+
assertNull(integrationReferenceModel.getIntegrationId());
35+
assertNull(integrationReferenceModel.getType());
36+
}
37+
}

0 commit comments

Comments
 (0)