001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.krms.impl.repository; 017 018import org.junit.Before; 019import org.junit.Test; 020import org.kuali.rice.krad.service.BusinessObjectService; 021import org.kuali.rice.krms.api.repository.ReferenceObjectBindingGenTest; 022import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding; 023import static org.mockito.Mockito.*; 024 025/** 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 * 028 */ 029public final class ReferenceObjectBindingBoServiceImplGenTest { 030 031 ReferenceObjectBindingBoServiceImpl referenceObjectBindingBoServiceImpl; 032 ReferenceObjectBinding referenceObjectBinding; 033 034 ReferenceObjectBinding getReferenceObjectBinding() { 035 return referenceObjectBinding; 036 } 037 038 public void setReferenceObjectBindingBoServiceImpl(ReferenceObjectBindingBoServiceImpl impl) { 039 this.referenceObjectBindingBoServiceImpl = impl; 040 } 041 042 public static org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest create(ReferenceObjectBindingBoServiceImpl impl) { 043 org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest test = new org.kuali.rice.krms.impl.repository.ReferenceObjectBindingBoServiceImplGenTest(); 044 test.setReferenceObjectBindingBoServiceImpl(impl); 045 return test; 046 } 047 048 @Before 049 public void setUp() { 050 referenceObjectBindingBoServiceImpl = new ReferenceObjectBindingBoServiceImpl(); 051 referenceObjectBindingBoServiceImpl.setBusinessObjectService(mock(BusinessObjectService.class));// TODO Import static org.mockito.Mockito.*; 052 } 053 054 @Test(expected = java.lang.IllegalArgumentException.class) 055 public void test_findReferenceObjectBindingsByCollectionName_null_fail() { 056 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByCollectionName(null); 057 } 058 059 @Test(expected = java.lang.IllegalArgumentException.class) 060 public void test_findReferenceObjectBindingsByKrmsDiscriminatorType_null_fail() { 061 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByKrmsDiscriminatorType(null); 062 } 063 064 @Test(expected = java.lang.IllegalArgumentException.class) 065 public void test_findReferenceObjectBindingsByKrmsObject_null_fail() { 066 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByKrmsObject(null); 067 } 068 069 @Test(expected = java.lang.IllegalArgumentException.class) 070 public void test_findReferenceObjectBindingsByNamespace_null_fail() { 071 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByNamespace(null); 072 } 073 074 @Test(expected = java.lang.IllegalArgumentException.class) 075 public void test_findReferenceObjectBindingsByReferenceDiscriminatorType_null_fail() { 076 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByReferenceDiscriminatorType(null); 077 } 078 079 @Test(expected = java.lang.IllegalArgumentException.class) 080 public void test_findReferenceObjectBindingsByReferenceObject_null_fail() { 081 referenceObjectBindingBoServiceImpl.findReferenceObjectBindingsByReferenceObject(null); 082 } 083 084 @Test 085 public void test_from_null_yields_null() { 086 assert(referenceObjectBindingBoServiceImpl.from(null) == null); 087 } 088 089 @Test 090 public void test_from() { 091 ReferenceObjectBinding def = ReferenceObjectBindingGenTest.buildFullReferenceObjectBinding(); 092 ReferenceObjectBindingBo referenceObjectBindingBo = referenceObjectBindingBoServiceImpl.from(def); 093 assert(referenceObjectBindingBo.getKrmsDiscriminatorType().equals(def.getKrmsDiscriminatorType())); 094 assert(referenceObjectBindingBo.getKrmsObjectId().equals(def.getKrmsObjectId())); 095 assert(referenceObjectBindingBo.getNamespace().equals(def.getNamespace())); 096 assert(referenceObjectBindingBo.getReferenceDiscriminatorType().equals(def.getReferenceDiscriminatorType())); 097 assert(referenceObjectBindingBo.getReferenceObjectId().equals(def.getReferenceObjectId())); 098 assert(referenceObjectBindingBo.getId().equals(def.getId())); 099 } 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}