01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.vendor.fixtures;
17:
18: import java.sql.Date;
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: import org.kuali.module.vendor.bo.VendorContract;
23: import org.kuali.module.vendor.fixtures.VendorTestConstants.BeginEndDates;
24:
25: public enum VendorContractBeginEndDatesFixture {
26:
27: RIGHT_ORDER_RIGHT_ORDER(BeginEndDates.FIRST_DATE,
28: BeginEndDates.LAST_DATE, BeginEndDates.FIRST_DATE,
29: BeginEndDates.LAST_DATE), WRONG_ORDER_RIGHT_ORDER(
30: BeginEndDates.LAST_DATE, BeginEndDates.FIRST_DATE,
31: BeginEndDates.FIRST_DATE, BeginEndDates.LAST_DATE), RIGHT_ORDER_WRONG_ORDER(
32: BeginEndDates.FIRST_DATE, BeginEndDates.LAST_DATE,
33: BeginEndDates.LAST_DATE, BeginEndDates.FIRST_DATE), WRONG_ORDER_WRONG_ORDER(
34: BeginEndDates.LAST_DATE, BeginEndDates.FIRST_DATE,
35: BeginEndDates.LAST_DATE, BeginEndDates.FIRST_DATE), ;
36:
37: private Date date11;
38: private Date date12;
39: private Date date21;
40: private Date date22;
41:
42: private VendorContractBeginEndDatesFixture(Date date11,
43: Date date12, Date date21, Date date22) {
44: this .date11 = date11;
45: this .date12 = date12;
46: this .date21 = date21;
47: this .date22 = date22;
48: }
49:
50: /**
51: * This method does the setup for the tests which examine the implementation of the requirement that vendor contracts be
52: * validated so that their begin date comes before their end date. Uses two contracts.
53: *
54: * @param date11 For the first contract, the begin date
55: * @param date12 For the first contract, the end date
56: * @param date21 For the second contract, the begin date
57: * @param date22 For the second contract, the end date
58: * @return A VendorRule object, with sufficient information to run the validation method
59: */
60: public List populateContracts() {
61: VendorContract contract1 = new VendorContract();
62: VendorContract contract2 = new VendorContract();
63: contract1.setVendorContractBeginningDate(date11);
64: contract1.setVendorContractEndDate(date12);
65: contract2.setVendorContractBeginningDate(date21);
66: contract2.setVendorContractEndDate(date22);
67: List<VendorContract> contracts = new ArrayList();
68: contracts.add(contract1);
69: contracts.add(contract2);
70: return contracts;
71: }
72: }
|