mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Removed print stacktrace and changed the check for exceptions.
This commit is contained in:
parent
aee8995ff6
commit
ae9c1a2c8b
@ -34,6 +34,7 @@ import org.wso2.carbon.device.mgt.core.common.TestDataHolder;
|
||||
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.InvalidOperatorException;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.SearchMgtException;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.impl.ProcessorImpl;
|
||||
import org.wso2.carbon.device.mgt.core.search.util.ChangeEnumValues;
|
||||
@ -116,7 +117,7 @@ public class ProcessorImplTest extends BaseDeviceManagementTest{
|
||||
|
||||
|
||||
@Test(description = "Test for invalid state")
|
||||
public void testInvalidState() {
|
||||
public void testInvalidState() throws SearchMgtException {
|
||||
SearchContext context = new SearchContext();
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
|
||||
@ -151,9 +152,9 @@ public class ProcessorImplTest extends BaseDeviceManagementTest{
|
||||
try {
|
||||
processor.execute(context);
|
||||
} catch (SearchMgtException e) {
|
||||
Boolean isInvalidOperation = e.getCause().getClass().getCanonicalName().contains
|
||||
("InvalidOperatorException");
|
||||
Assert.assertTrue(isInvalidOperation);
|
||||
if (!(e.getCause() instanceof InvalidOperatorException)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.core.common.BaseDeviceManagementTest;
|
||||
import org.wso2.carbon.device.mgt.core.common.TestDataHolder;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
|
||||
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementServiceComponent;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.InvalidOperatorException;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.SearchManagerService;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.SearchMgtException;
|
||||
import org.wso2.carbon.device.mgt.core.search.mgt.impl.SearchManagerServiceImpl;
|
||||
@ -204,7 +205,7 @@ public class SearchManagementServiceTest extends BaseDeviceManagementTest {
|
||||
}
|
||||
|
||||
@Test(description = "Test for invalid number")
|
||||
public void testInvalidNumber() {
|
||||
public void testInvalidNumber() throws SearchMgtException {
|
||||
SearchContext context = new SearchContext();
|
||||
List<Condition> conditions = new ArrayList<>();
|
||||
|
||||
@ -221,8 +222,9 @@ public class SearchManagementServiceTest extends BaseDeviceManagementTest {
|
||||
try {
|
||||
service.search(context);
|
||||
} catch (SearchMgtException e) {
|
||||
String expectedException = e.getCause().getClass().getName();
|
||||
Assert.assertTrue(expectedException.contains("InvalidOperatorException"));
|
||||
if (!(e.getCause() instanceof InvalidOperatorException)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +125,6 @@ public class ChangeEnumValues {
|
||||
cleanEnumCache(enumType);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user