dangsn
2024-06-11 dba1e53cd7652f1b973ffec118e5b3312278c814
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.vci.server.framework.appConfig;
import static org.junit.Assert.*;
import java.util.Date;
import java.util.List;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
 
import com.vci.common.objects.UserEntity;
    /**
    * AppConfigCategory DAO Service Test
    *
    */
    public class AppConfigCategoryServiceTest {
        private UserEntity userEntity = new UserEntity();
        
        @BeforeClass
        public static void setUpBeforeClass() throws Exception {
        }
    
        @AfterClass
        public static void tearDownAfterClass() throws Exception {
        }
    
        @Before
        public void setUp() throws Exception {
            userEntity.setUserName("xc");
            userEntity.setModule(this.getClass().getName());
            userEntity.setIp("192.168.0.26");
        }
    
        @After
        public void tearDown() throws Exception {
        }
    
        @Test
        public void testSaveAppConfigCategory() {
            AppConfigCategory object = new AppConfigCategory();
            AppConfigCategoryService service = new AppConfigCategoryService(userEntity);
            object.setId("");
            object.setName("");
            object.setDesc("");
            boolean res = service.saveAppConfigCategory(object);
            assertEquals(true, res);
        }
    
        @Test
        public void testUpdateAppConfigCategory() {
            AppConfigCategory object = new AppConfigCategory();
            AppConfigCategoryService service = new AppConfigCategoryService(userEntity);
            object.setId("");
            object.setName("");
            object.setDesc("");
            boolean res = service.updateAppConfigCategory(object);
            assertEquals(true, res);
        }
        
        @Test
        public void testDeleteAppConfigCategoryStringArray() {
            AppConfigCategoryService service = new AppConfigCategoryService(userEntity);
            boolean res = service.deleteAppConfigCategory(new String[]{"123", "456"});
            assertEquals(true, res);
        }
    
        @Test
        public void testGetAppConfigCategorys() {
            AppConfigCategoryService service = new AppConfigCategoryService(userEntity);
            List<AppConfigCategory> objects = service.getAppConfigCategorys();
            int size = objects.size();
            for(AppConfigCategory object : objects){
                System.out.println(object);
            }
            assertEquals(2, size);
        }
        
        @Test
        public void testGetAppConfigCategoryById() {
            AppConfigCategoryService service = new AppConfigCategoryService(userEntity);
            AppConfigCategory object = service.getAppConfigCategoryById("123");
            assertEquals("123", object.getId());
        }
    }