Fanadia_Friska

testget nadia

Sep 15th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. package org.jleaf.erp.master.bo.test.customer.vs.rayon;
  2.  
  3.  
  4. import junit.framework.Assert;
  5.  
  6. import org.jleaf.core.BusinessFunction;
  7. import org.jleaf.core.Dto;
  8. import org.jleaf.core.test.AbstractSpringDbUnitTest;
  9. import org.junit.Before;
  10. import org.junit.Test;
  11. import org.junit.runner.RunWith;
  12. import org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.beans.factory.annotation.Qualifier;
  16. import org.springframework.test.context.ContextConfiguration;
  17. import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  18. import org.springframework.test.context.transaction.TransactionConfiguration;
  19. import org.springframework.transaction.annotation.Transactional;
  20.  
  21. @RunWith(SpringJUnit4ClassRunner.class)
  22. @ContextConfiguration(locations = { "classpath:applicationContext.xml" })
  23. @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
  24. @Transactional
  25. public class TestGetRegionCustomerList extends AbstractSpringDbUnitTest {
  26. @SuppressWarnings("unused")
  27. private static final Logger log = LoggerFactory
  28. .getLogger(TestGetRegionCustomerList.class);
  29.  
  30. @Autowired
  31. @Qualifier("getRegionCustomerList")
  32. private BusinessFunction getRegionCustomerList;
  33.  
  34. @Before
  35. public void prepareData() {
  36. super.deleteFromTables("m_region_customer", "m_region", "m_partner");
  37. super.executeSqlScript("scripts/TestGetRegionCustomerList.sql", false);
  38. }
  39.  
  40.  
  41.  
  42. @Test
  43. public void testKasus1() throws Exception {
  44. Dto testDto = new Dto();
  45. testDto.put("tenantId", 23L);
  46. testDto.put("customerCodeName", "");
  47. testDto.put("regionId", 15000002);
  48. testDto.put("limit", 10L);
  49. testDto.put("offset", 0L);
  50.  
  51. Dto getDto = getRegionCustomerList.execute(testDto);
  52. logger.debug(">> hasil: " + getDto);
  53.  
  54. Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
  55.  
  56. }
  57.  
  58.  
  59. @Test
  60. public void testKasus2() throws Exception {
  61. Dto testDto = new Dto();
  62. testDto.put("tenantId", 23L);
  63. testDto.put("customerCodeName", "1");
  64. testDto.put("regionId", 15000002);
  65. testDto.put("limit", 10L);
  66. testDto.put("offset", 0L);
  67.  
  68. Dto getDto = getRegionCustomerList.execute(testDto);
  69. logger.debug(">> hasil: " + getDto);
  70.  
  71. Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
  72.  
  73. }
  74.  
  75.  
  76. @Test
  77. public void testKasus3() throws Exception {
  78. Dto testDto = new Dto();
  79. testDto.put("tenantId", 10L);
  80. testDto.put("customerCodeName", "");
  81. testDto.put("regionId", 15000002);
  82. testDto.put("limit", 10L);
  83. testDto.put("offset", 0L);
  84.  
  85. Dto getDto = getRegionCustomerList.execute(testDto);
  86. logger.debug(">> hasil: " + getDto);
  87.  
  88. Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
  89.  
  90. }
  91.  
  92. @Test
  93. public void testKasus4() throws Exception {
  94. Dto testDto = new Dto();
  95. testDto.put("tenantId", 10L);
  96. testDto.put("customerCodeName", "16000011");
  97. testDto.put("regionId", 15000002);
  98. testDto.put("limit", 10L);
  99. testDto.put("offset", 0L);
  100.  
  101. Dto getDto = getRegionCustomerList.execute(testDto);
  102. logger.debug(">> hasil: " + getDto);
  103.  
  104. Assert.assertEquals(0, getDto.getList("RegionCustomerList").size());
  105.  
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment