1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.impl.repository;
17
18 import org.junit.Before;
19 import org.junit.Test;
20 import org.kuali.rice.krad.data.DataObjectService;
21 import org.kuali.rice.krms.api.repository.NaturalLanguageUsageGenTest;
22 import org.kuali.rice.krms.api.repository.language.NaturalLanguageUsage;
23
24 import static org.mockito.Mockito.mock;
25
26
27
28
29
30 public final class NaturalLanguageUsageBoServiceImplGenTest {
31
32 NaturalLanguageUsageBoServiceImpl naturalLanguageUsageBoServiceImpl;
33 NaturalLanguageUsage naturalLanguageUsage;
34
35 NaturalLanguageUsage getNaturalLanguageUsage() {
36 return naturalLanguageUsage;
37 }
38
39 public void setNaturalLanguageUsageBoServiceImpl(NaturalLanguageUsageBoServiceImpl impl) {
40 this.naturalLanguageUsageBoServiceImpl = impl;
41 }
42
43 public static org.kuali.rice.krms.impl.repository.NaturalLanguageUsageBoServiceImplGenTest create(NaturalLanguageUsageBoServiceImpl impl) {
44 org.kuali.rice.krms.impl.repository.NaturalLanguageUsageBoServiceImplGenTest test = new org.kuali.rice.krms.impl.repository.NaturalLanguageUsageBoServiceImplGenTest();
45 test.setNaturalLanguageUsageBoServiceImpl(impl);
46 return test;
47 }
48
49 @Before
50 public void setUp() {
51 naturalLanguageUsageBoServiceImpl = new NaturalLanguageUsageBoServiceImpl();
52 naturalLanguageUsageBoServiceImpl.setDataObjectService(mock(DataObjectService.class));
53 }
54
55 @Test(expected = java.lang.IllegalArgumentException.class)
56 public void test_findNaturalLanguageUsagesByName_null_fail() {
57 naturalLanguageUsageBoServiceImpl.findNaturalLanguageUsagesByName(null);
58 }
59
60 @Test(expected = java.lang.IllegalArgumentException.class)
61 public void test_findNaturalLanguageUsagesByDescription_null_fail() {
62 naturalLanguageUsageBoServiceImpl.findNaturalLanguageUsagesByDescription(null);
63 }
64
65 @Test(expected = java.lang.IllegalArgumentException.class)
66 public void test_findNaturalLanguageUsagesByNamespace_null_fail() {
67 naturalLanguageUsageBoServiceImpl.findNaturalLanguageUsagesByNamespace(null);
68 }
69
70 @Test
71 public void test_from_null_yields_null() {
72 assert(naturalLanguageUsageBoServiceImpl.from(null) == null);
73 }
74
75 @Test
76 public void test_from() {
77 NaturalLanguageUsage def = NaturalLanguageUsageGenTest.buildFullNaturalLanguageUsage();
78 NaturalLanguageUsageBo naturalLanguageUsageBo = naturalLanguageUsageBoServiceImpl.from(def);
79 assert(naturalLanguageUsageBo.getName().equals(def.getName()));
80 assert(naturalLanguageUsageBo.getNamespace().equals(def.getNamespace()));
81 assert(naturalLanguageUsageBo.getId().equals(def.getId()));
82 }
83
84 @Test
85 public void test_to() {
86 NaturalLanguageUsage def = NaturalLanguageUsageGenTest.buildFullNaturalLanguageUsage();
87 NaturalLanguageUsageBo naturalLanguageUsageBo = naturalLanguageUsageBoServiceImpl.from(def);
88 NaturalLanguageUsage def2 = NaturalLanguageUsageBo.to(naturalLanguageUsageBo);
89 assert(def.equals(def2));
90 }
91
92 @Test
93 public void test_createNaturalLanguageUsage() {
94 NaturalLanguageUsage def = NaturalLanguageUsageGenTest.buildFullNaturalLanguageUsage();
95
96 naturalLanguageUsage = naturalLanguageUsageBoServiceImpl.getNaturalLanguageUsageByName(def.getNamespace(), def.getName());
97
98 if (naturalLanguageUsage == null) {
99 naturalLanguageUsage = naturalLanguageUsageBoServiceImpl.createNaturalLanguageUsage(def);
100 }
101 }
102
103 @Test(expected = java.lang.IllegalArgumentException.class)
104 public void test_createNaturalLanguageUsage_null_fail() {
105 naturalLanguageUsageBoServiceImpl.createNaturalLanguageUsage(null);
106 }
107
108 @Test(expected = java.lang.IllegalArgumentException.class)
109 public void test_updateNaturalLanguageUsage_null_fail() {
110 naturalLanguageUsageBoServiceImpl.updateNaturalLanguageUsage(null);
111 }
112
113 @Test(expected = java.lang.IllegalArgumentException.class)
114 public void test_deleteNaturalLanguageUsage_null_fail() {
115 naturalLanguageUsageBoServiceImpl.deleteNaturalLanguageUsage(null);
116 }
117
118
119
120
121
122
123
124 }