View Javadoc

1   /**
2    * Copyright 2005-2013 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.krad.service.BusinessObjectService;
21  import org.kuali.rice.krms.api.repository.ReferenceObjectBindingGenTest;
22  import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
23  import static org.mockito.Mockito.*;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   * 
28   */
29  public final class ReferenceObjectBindingBoServiceImplGenTest {
30  
31      ReferenceObjectBindingBoServiceImpl referenceObjectBindingBoServiceImpl;
32      ReferenceObjectBinding referenceObjectBinding;
33  
34      ReferenceObjectBinding getReferenceObjectBinding() {
35          return referenceObjectBinding;
36      }
37  
38      public void setReferenceObjectBindingBoServiceImpl(ReferenceObjectBindingBoServiceImpl impl) {
39          this.referenceObjectBindingBoServiceImpl = impl;
40      }
41  
42      public static org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest create(ReferenceObjectBindingBoServiceImpl impl) {
43          org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest test = new org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest();
44          test.setReferenceObjectBindingBoServiceImpl(impl);
45          return test;
46      }
47  
48      @Before
49      public void setUp() {
50          referenceObjectBindingBoServiceImpl = new ReferenceObjectBindingBoServiceImpl();
51          referenceObjectBindingBoServiceImpl.setBusinessObjectService(mock(BusinessObjectService.class));// TODO Import static org.mockito.Mockito.*;
52      }
53  
54      @Test(expected = java.lang.IllegalArgumentException.class)
55      public void test_findReferenceObjectBindingsByCollectionName_null_fail() {
56          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByCollectionName(null);
57      }
58  
59      @Test(expected = java.lang.IllegalArgumentException.class)
60      public void test_findReferenceObjectBindingsByKrmsDiscriminatorType_null_fail() {
61          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByKrmsDiscriminatorType(null);
62      }
63  
64      @Test(expected = java.lang.IllegalArgumentException.class)
65      public void test_findReferenceObjectBindingsByKrmsObject_null_fail() {
66          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByKrmsObject(null);
67      }
68  
69      @Test(expected = java.lang.IllegalArgumentException.class)
70      public void test_findReferenceObjectBindingsByNamespace_null_fail() {
71          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByNamespace(null);
72      }
73  
74      @Test(expected = java.lang.IllegalArgumentException.class)
75      public void test_findReferenceObjectBindingsByReferenceDiscriminatorType_null_fail() {
76          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByReferenceDiscriminatorType(null);
77      }
78  
79      @Test(expected = java.lang.IllegalArgumentException.class)
80      public void test_findReferenceObjectBindingsByReferenceObject_null_fail() {
81          referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByReferenceObject(null);
82      }
83  
84      @Test
85      public void test_from_null_yields_null() {
86          assert(referenceObjectBindingBoServiceImpl.from(null) == null);
87      }
88  
89      @Test
90      public void test_from() {
91          ReferenceObjectBinding def = ReferenceObjectBindingGenTest.buildFullReferenceObjectBinding();
92          ReferenceObjectBindingBo referenceObjectBindingBo = referenceObjectBindingBoServiceImpl.from(def);
93          assert(referenceObjectBindingBo.getKrmsDiscriminatorType().equals(def.getKrmsDiscriminatorType()));
94          assert(referenceObjectBindingBo.getKrmsObjectId().equals(def.getKrmsObjectId()));
95          assert(referenceObjectBindingBo.getNamespace().equals(def.getNamespace()));
96          assert(referenceObjectBindingBo.getReferenceDiscriminatorType().equals(def.getReferenceDiscriminatorType()));
97          assert(referenceObjectBindingBo.getReferenceObjectId().equals(def.getReferenceObjectId()));
98          assert(referenceObjectBindingBo.getId().equals(def.getId()));
99      }
100 
101     @Test
102     public void test_to() {
103         ReferenceObjectBinding def = ReferenceObjectBindingGenTest.buildFullReferenceObjectBinding();
104         ReferenceObjectBindingBo referenceObjectBindingBo = referenceObjectBindingBoServiceImpl.from(def);
105         ReferenceObjectBinding def2 = ReferenceObjectBindingBo.to(referenceObjectBindingBo);
106         assert(def.equals(def2));
107     }
108 
109     @Test
110     public void test_createReferenceObjectBinding() {
111         ReferenceObjectBinding def = ReferenceObjectBindingGenTest.buildFullReferenceObjectBinding();
112         referenceObjectBinding = referenceObjectBindingBoServiceImpl.createReferenceObjectBinding(def);
113     }
114 
115     @Test(expected = java.lang.IllegalArgumentException.class)
116     public void test_createReferenceObjectBinding_null_fail() {
117         referenceObjectBindingBoServiceImpl.createReferenceObjectBinding(null);
118     }
119 
120     @Test(expected = java.lang.IllegalArgumentException.class)
121     public void test_updateReferenceObjectBinding_null_fail() {
122         referenceObjectBindingBoServiceImpl.updateReferenceObjectBinding(null);
123     }
124 
125     @Test(expected = java.lang.IllegalArgumentException.class)
126     public void test_deleteReferenceObjectBinding_null_fail() {
127         referenceObjectBindingBoServiceImpl.deleteReferenceObjectBinding(null);
128     }
129 
130 //    void create() { // TODO gen
131 //        ReferenceObjectBinding def = ReferenceObjectBindingGenTest.buildFullFKReferenceObjectBinding(params);
132 //    }
133 
134 }