Skip to content

Commit

Permalink
test(assistantv2): update unit tests for new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
apaparazzi0329 committed Aug 10, 2022
1 parent 2f164cd commit faea1a2
Show file tree
Hide file tree
Showing 18 changed files with 1,031 additions and 3 deletions.
324 changes: 321 additions & 3 deletions assistant/src/test/java/com/ibm/watson/assistant/v2/AssistantTest.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the DeployReleaseOptions model. */
public class DeployReleaseOptionsTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testDeployReleaseOptions() throws Throwable {
DeployReleaseOptions deployReleaseOptionsModel =
new DeployReleaseOptions.Builder()
.assistantId("testString")
.release("testString")
.environmentId("testString")
.includeAudit(false)
.build();
assertEquals(deployReleaseOptionsModel.assistantId(), "testString");
assertEquals(deployReleaseOptionsModel.release(), "testString");
assertEquals(deployReleaseOptionsModel.environmentId(), "testString");
assertEquals(deployReleaseOptionsModel.includeAudit(), Boolean.valueOf(false));
}

@Test(expectedExceptions = IllegalArgumentException.class)
public void testDeployReleaseOptionsError() throws Throwable {
new DeployReleaseOptions.Builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the EnvironmentCollection model. */
public class EnvironmentCollectionTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testEnvironmentCollection() throws Throwable {
EnvironmentCollection environmentCollectionModel = new EnvironmentCollection();
assertNull(environmentCollectionModel.getEnvironments());
assertNull(environmentCollectionModel.getPagination());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the EnvironmentOrchestration model. */
public class EnvironmentOrchestrationTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testEnvironmentOrchestration() throws Throwable {
EnvironmentOrchestration environmentOrchestrationModel = new EnvironmentOrchestration();
assertNull(environmentOrchestrationModel.isSearchSkillFallback());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the EnvironmentReference model. */
public class EnvironmentReferenceTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testEnvironmentReference() throws Throwable {
EnvironmentReference environmentReferenceModel = new EnvironmentReference();
assertNull(environmentReferenceModel.getName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the EnvironmentReleaseReference model. */
public class EnvironmentReleaseReferenceTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testEnvironmentReleaseReference() throws Throwable {
EnvironmentReleaseReference environmentReleaseReferenceModel =
new EnvironmentReleaseReference();
assertNull(environmentReleaseReferenceModel.getRelease());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the Environment model. */
public class EnvironmentTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testEnvironment() throws Throwable {
Environment environmentModel = new Environment();
assertNull(environmentModel.getName());
assertNull(environmentModel.getDescription());
assertNull(environmentModel.getLanguage());
assertNull(environmentModel.getReleaseReference());
assertNull(environmentModel.getOrchestration());
assertNull(environmentModel.getSessionTimeout());
assertNull(environmentModel.getIntegrationReferences());
assertNull(environmentModel.getSkillReferences());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the GetEnvironmentOptions model. */
public class GetEnvironmentOptionsTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testGetEnvironmentOptions() throws Throwable {
GetEnvironmentOptions getEnvironmentOptionsModel =
new GetEnvironmentOptions.Builder()
.assistantId("testString")
.environmentId("testString")
.includeAudit(false)
.build();
assertEquals(getEnvironmentOptionsModel.assistantId(), "testString");
assertEquals(getEnvironmentOptionsModel.environmentId(), "testString");
assertEquals(getEnvironmentOptionsModel.includeAudit(), Boolean.valueOf(false));
}

@Test(expectedExceptions = IllegalArgumentException.class)
public void testGetEnvironmentOptionsError() throws Throwable {
new GetEnvironmentOptions.Builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the GetReleaseOptions model. */
public class GetReleaseOptionsTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testGetReleaseOptions() throws Throwable {
GetReleaseOptions getReleaseOptionsModel =
new GetReleaseOptions.Builder()
.assistantId("testString")
.release("testString")
.includeAudit(false)
.build();
assertEquals(getReleaseOptionsModel.assistantId(), "testString");
assertEquals(getReleaseOptionsModel.release(), "testString");
assertEquals(getReleaseOptionsModel.includeAudit(), Boolean.valueOf(false));
}

@Test(expectedExceptions = IllegalArgumentException.class)
public void testGetReleaseOptionsError() throws Throwable {
new GetReleaseOptions.Builder().build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* (C) Copyright IBM Corp. 2022.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/

package com.ibm.watson.assistant.v2.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.assistant.v2.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the IntegrationReference model. */
public class IntegrationReferenceTest {
final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
final List<FileWithMetadata> mockListFileWithMetadata =
TestUtilities.creatMockListFileWithMetadata();

@Test
public void testIntegrationReference() throws Throwable {
IntegrationReference integrationReferenceModel = new IntegrationReference();
assertNull(integrationReferenceModel.getIntegrationId());
assertNull(integrationReferenceModel.getType());
}
}
Loading

0 comments on commit faea1a2

Please sign in to comment.