Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jleaf.erp.master.bo.test.customer.vs.rayon;
- import junit.framework.Assert;
- import org.jleaf.core.BusinessFunction;
- import org.jleaf.core.Dto;
- import org.jleaf.core.test.AbstractSpringDbUnitTest;
- import org.junit.Before;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Qualifier;
- import org.springframework.test.context.ContextConfiguration;
- import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
- import org.springframework.test.context.transaction.TransactionConfiguration;
- import org.springframework.transaction.annotation.Transactional;
- @RunWith(SpringJUnit4ClassRunner.class)
- @ContextConfiguration(locations = { "classpath:applicationContext.xml" })
- @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
- @Transactional
- public class TestGetRegionCustomerList extends AbstractSpringDbUnitTest {
- @SuppressWarnings("unused")
- private static final Logger log = LoggerFactory
- .getLogger(TestGetRegionCustomerList.class);
- @Autowired
- @Qualifier("getRegionCustomerList")
- private BusinessFunction getRegionCustomerList;
- @Before
- public void prepareData() {
- super.deleteFromTables("m_region_customer", "m_region", "m_partner");
- super.executeSqlScript("scripts/TestGetRegionCustomerList.sql", false);
- }
- @Test
- public void testKasus1() throws Exception {
- Dto testDto = new Dto();
- testDto.put("tenantId", 23L);
- testDto.put("customerCodeName", "");
- testDto.put("regionId", 15000002);
- testDto.put("limit", 10L);
- testDto.put("offset", 0L);
- Dto getDto = getRegionCustomerList.execute(testDto);
- logger.debug(">> hasil: " + getDto);
- Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
- }
- @Test
- public void testKasus2() throws Exception {
- Dto testDto = new Dto();
- testDto.put("tenantId", 23L);
- testDto.put("customerCodeName", "1");
- testDto.put("regionId", 15000002);
- testDto.put("limit", 10L);
- testDto.put("offset", 0L);
- Dto getDto = getRegionCustomerList.execute(testDto);
- logger.debug(">> hasil: " + getDto);
- Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
- }
- @Test
- public void testKasus3() throws Exception {
- Dto testDto = new Dto();
- testDto.put("tenantId", 10L);
- testDto.put("customerCodeName", "");
- testDto.put("regionId", 15000002);
- testDto.put("limit", 10L);
- testDto.put("offset", 0L);
- Dto getDto = getRegionCustomerList.execute(testDto);
- logger.debug(">> hasil: " + getDto);
- Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
- }
- @Test
- public void testKasus4() throws Exception {
- Dto testDto = new Dto();
- testDto.put("tenantId", 10L);
- testDto.put("customerCodeName", "16000011");
- testDto.put("regionId", 15000002);
- testDto.put("limit", 10L);
- testDto.put("offset", 0L);
- Dto getDto = getRegionCustomerList.execute(testDto);
- logger.debug(">> hasil: " + getDto);
- Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment