Merge pull request 'deviceOrgFix: service negative test fix' (#330) from isuri/device-mgt-core:deviceOrganizationFixes into master

Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/330
This commit is contained in:
Pahansith Gunathilake 2024-01-31 08:31:41 +00:00
commit 3fe96312ad

View File

@ -96,32 +96,6 @@ public class ServiceNegativeTest extends BaseDeviceOrganizationTest {
deviceOrganizationService.addDeviceOrganization(invalidOrganization); deviceOrganizationService.addDeviceOrganization(invalidOrganization);
} }
@Test(description = "This method tests Add Device Organization method under negative circumstances with invalid" +
"parent ID",
expectedExceptions = {DeviceOrganizationMgtPluginException.class})
public void testAddDeviceOrganizationWithInvalidParentID() throws DeviceOrganizationMgtPluginException {
DeviceOrganization deviceOrganizationOne = new DeviceOrganization();
deviceOrganizationOne.setDeviceId(3);
deviceOrganizationOne.setParentDeviceId(30);
deviceOrganizationOne.setDeviceOrganizationMeta("Physical Relationship");
boolean result1 = deviceOrganizationService.addDeviceOrganization(deviceOrganizationOne);
}
@Test(description = "This method tests Add Device Organization method under negative circumstances with invalid" +
"child ID",
expectedExceptions = {DeviceOrganizationMgtPluginException.class})
public void testAddDeviceOrganizationWithInvalidChildID() throws DeviceOrganizationMgtPluginException {
DeviceOrganization deviceOrganizationOne = new DeviceOrganization();
deviceOrganizationOne.setDeviceId(30);
deviceOrganizationOne.setParentDeviceId(3);
deviceOrganizationOne.setDeviceOrganizationMeta("Physical Relationship");
boolean result1 = deviceOrganizationService.addDeviceOrganization(deviceOrganizationOne);
}
@Test(description = "This method tests isDeviceOrganizationExist method under negative circumstances with an organization that doesn't exist") @Test(description = "This method tests isDeviceOrganizationExist method under negative circumstances with an organization that doesn't exist")
public void testOrganizationDoesNotExist() throws DeviceOrganizationMgtPluginException { public void testOrganizationDoesNotExist() throws DeviceOrganizationMgtPluginException {
int nonExistentDeviceId = 9999; // An ID that doesn't exist int nonExistentDeviceId = 9999; // An ID that doesn't exist