View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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.krms.api.repository.language.NaturalLanguageUsage;
21  import org.kuali.rice.krms.test.AbstractBoTest;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   *
26   */
27  public final class NaturalLanguageUsageIntegrationGenTest extends AbstractBoTest{
28  
29      NaturalLanguageUsageBoServiceImpl naturalLanguageUsageBoServiceImpl;
30      NaturalLanguageUsage naturalLanguageUsage;
31  
32      NaturalLanguageUsage getNaturalLanguageUsage() {
33          return naturalLanguageUsage;
34      }
35  
36      /**
37       * Note lower case u, do not override superclasses setUp
38       *
39       */
40      @Before
41      public void setup() {
42          naturalLanguageUsageBoServiceImpl = new NaturalLanguageUsageBoServiceImpl();
43          naturalLanguageUsageBoServiceImpl.setBusinessObjectService(getBoService());
44      }
45  
46      @Test(expected = java.lang.IllegalArgumentException.class)
47      public void test_findNaturalLanguageUsagesByName_null_fail() {
48          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_findNaturalLanguageUsagesByName_null_fail();
49      }
50  
51      @Test(expected = java.lang.IllegalArgumentException.class)
52      public void test_findNaturalLanguageUsagesByDescription_null_fail() {
53          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_findNaturalLanguageUsagesByDescription_null_fail();
54      }
55  
56      @Test(expected = java.lang.IllegalArgumentException.class)
57      public void test_findNaturalLanguageUsagesByNamespace_null_fail() {
58          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_findNaturalLanguageUsagesByNamespace_null_fail();
59      }
60  
61      @Test
62      public void test_from_null_yields_null() {
63          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_from_null_yields_null();
64      }
65  
66      @Test
67      public void test_to() {
68          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_to();
69      }
70  
71      @Test
72      public void test_createNaturalLanguageUsage() {
73          NaturalLanguageUsageBoServiceImplGenTest test = NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl);
74          test.test_createNaturalLanguageUsage();
75          naturalLanguageUsage = test.getNaturalLanguageUsage();
76          assert(naturalLanguageUsage != null);
77          assert(naturalLanguageUsage.getId() != null);
78      }
79  
80      @Test(expected = java.lang.IllegalArgumentException.class)
81      public void test_createNaturalLanguageUsage_null_fail() {
82          (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_createNaturalLanguageUsage_null_fail();
83      }
84  
85      @Test
86      public void test_getNaturalLanguageUsage() {
87          test_createNaturalLanguageUsage();
88          NaturalLanguageUsage def = getNaturalLanguageUsage();
89          NaturalLanguageUsage def2 = naturalLanguageUsageBoServiceImpl.getNaturalLanguageUsage(def.getId());
90          assert(def2 != null);
91          assert(def2.equals(def));
92      }
93  
94      @Test
95      public void test_updateNaturalLanguageUsage() {
96          test_createNaturalLanguageUsage();
97          NaturalLanguageUsage def = getNaturalLanguageUsage();
98          String id = def.getId();
99          assert(!"UpdateTest".equals(def.getName()));
100         NaturalLanguageUsageBo bo = naturalLanguageUsageBoServiceImpl.from(def);
101         bo.setName("UpdateTest");
102         naturalLanguageUsageBoServiceImpl.updateNaturalLanguageUsage(NaturalLanguageUsage.Builder.create(bo).build());
103         NaturalLanguageUsage def2 = naturalLanguageUsageBoServiceImpl.getNaturalLanguageUsage(id);
104         assert("UpdateTest".equals(def2.getName()));
105     }
106 
107     @Test(expected = java.lang.IllegalArgumentException.class)
108     public void test_updateNaturalLanguageUsage_null_fail() {
109         (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_updateNaturalLanguageUsage_null_fail();
110     }
111 
112     @Test
113     public void test_deleteNaturalLanguageUsage() {
114         test_createNaturalLanguageUsage();
115         NaturalLanguageUsage def = getNaturalLanguageUsage();
116         String id = def.getId();
117         naturalLanguageUsageBoServiceImpl.deleteNaturalLanguageUsage(id);
118         NaturalLanguageUsage def2 = naturalLanguageUsageBoServiceImpl.getNaturalLanguageUsage(id);
119         assert(def2 == null);
120     }
121 
122     @Test(expected = java.lang.IllegalArgumentException.class)
123     public void test_deleteNaturalLanguageUsage_null_fail() {
124         (NaturalLanguageUsageBoServiceImplGenTest.create(naturalLanguageUsageBoServiceImpl)).test_deleteNaturalLanguageUsage_null_fail();
125     }
126 
127 }