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