View Javadoc

1   /**
2    * Copyright 2004-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.hr.time.util;
17  
18  import java.sql.Date;
19  import java.util.Map;
20  
21  import org.joda.time.DateTime;
22  import org.junit.Assert;
23  import org.junit.Test;
24  import org.kuali.hr.test.KPMETestCase;
25  import org.kuali.hr.time.detail.web.ActionFormUtils;
26  import org.kuali.hr.time.test.TkTestUtils;
27  import org.kuali.hr.time.timesheet.TimesheetDocument;
28  
29  public class ActionFormUtilsTest extends KPMETestCase {
30  	
31  	@Test
32  	public void testBuildAssignmentStyleClassMap() {
33  		Date aDate = new Date((new DateTime(2011, 7, 7, 0, 0, 0, 0, TKUtils.getSystemDateTimeZone())).getMillis());
34  		TimesheetDocument doc = TkTestUtils.populateTimesheetDocument(aDate);
35  		Map<String, String> aMap = ActionFormUtils.buildAssignmentStyleClassMap(doc.getTimeBlocks());
36  		Assert.assertEquals("Wrong number of classes in style class map", 1, aMap.size());
37  		Assert.assertEquals("Wrong key for class assignment0", "assignment0", aMap.get("1_1234_1"));
38  	}
39  
40  }