|
|
|
@ -17,25 +17,61 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
package io.entgra.device.mgt.core.factory.mgt.core;
|
|
|
|
|
//
|
|
|
|
|
//import io.entgra.device.mgt.core.factory.mgt.common.spi.ProductionPlanService;
|
|
|
|
|
//import io.entgra.device.mgt.core.factory.mgt.core.impl.ProductionPlanServiceImpl;
|
|
|
|
|
//import io.entgra.device.mgt.core.factory.mgt.core.mock.BaseFactoryMgtPluginTest;
|
|
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.common.dto.ProductionPlan;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.common.exception.BadRequestException;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtPluginException;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.common.spi.ProductionPlanService;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.core.service.impl.ProductionPlanServiceImpl;
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.core.mock.BaseFactoryMgtPluginTest;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.testng.Assert;
|
|
|
|
|
import org.testng.annotations.BeforeClass;
|
|
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.factory.mgt.core.mock.BaseFactoryMgtPluginTest;
|
|
|
|
|
import org.testng.annotations.Test;
|
|
|
|
|
|
|
|
|
|
public class ServiceNegativeTest extends BaseFactoryMgtPluginTest {
|
|
|
|
|
|
|
|
|
|
private static final Log log = LogFactory.getLog(ServiceNegativeTest.class);
|
|
|
|
|
// private ProductionPlanService productionPlanService;
|
|
|
|
|
private ProductionPlanService productionPlanService;
|
|
|
|
|
|
|
|
|
|
@BeforeClass
|
|
|
|
|
public void init() {
|
|
|
|
|
// productionPlanService = new ProductionPlanServiceImpl();
|
|
|
|
|
log.info("Service test initialized");
|
|
|
|
|
productionPlanService = new ProductionPlanServiceImpl();
|
|
|
|
|
log.info("Service Negative test initialized");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(description = "This method tests Add Production Plan method under negative circumstances with null data",
|
|
|
|
|
expectedExceptions = {FactoryMgtPluginException.class})
|
|
|
|
|
public void testAddProductionPlan() throws FactoryMgtPluginException {
|
|
|
|
|
ProductionPlan productionPlan = new ProductionPlan();
|
|
|
|
|
boolean result = productionPlanService.addProductionPlan(productionPlan);
|
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(description = "This method tests Update Production Plan method under negative circumstances with null data",
|
|
|
|
|
expectedExceptions = {FactoryMgtPluginException.class})
|
|
|
|
|
public void testUpdateProductionPlanWithEmptyData() throws FactoryMgtPluginException, FactoryMgtException {
|
|
|
|
|
ProductionPlan productionPlan = new ProductionPlan();
|
|
|
|
|
boolean result = productionPlanService.updateProductionPlan(productionPlan);
|
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(description = "This method tests Update Production Plan method under negative circumstances with null data",
|
|
|
|
|
expectedExceptions = {BadRequestException.class})
|
|
|
|
|
public void testUpdateProductionPlanWithInvalidId() throws FactoryMgtPluginException, FactoryMgtException {
|
|
|
|
|
ProductionPlan productionPlan = new ProductionPlan();
|
|
|
|
|
productionPlan.setId(0);
|
|
|
|
|
boolean result = productionPlanService.updateProductionPlan(productionPlan);
|
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test(description = "This method tests Delete Production Plan method under negative circumstances with null data",
|
|
|
|
|
expectedExceptions = {FactoryMgtPluginException.class})
|
|
|
|
|
public void testDeleteProductionPlanWithInvalidId() throws FactoryMgtPluginException {
|
|
|
|
|
boolean result = productionPlanService.deleteProductionPlan(0);
|
|
|
|
|
Assert.assertTrue(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|