001    /**
002     * Copyright 2004-2012 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     */
016    package org.kuali.hr.time.summary;
017    
018    import java.math.BigDecimal;
019    import java.sql.Timestamp;
020    import java.util.Map;
021    
022    import org.joda.time.DateTime;
023    import org.junit.Assert;
024    import org.junit.Test;
025    import org.kuali.hr.test.KPMETestCase;
026    import org.kuali.hr.time.test.TkTestUtils;
027    import org.kuali.hr.time.timeblock.TimeBlock;
028    import org.kuali.hr.time.timeblock.TimeHourDetail;
029    
030    public class TimeSummaryTest extends KPMETestCase {
031    
032            @Test
033            public void testTimeBlockTimeHourDetailBreakup() throws Exception{
034                    DateTime beginTime = new DateTime(2010, 1, 2, 1, 0, 0, 0);
035                    DateTime endTime = new DateTime(2010, 1, 4, 2, 0, 0, 0);
036    
037                    TimeBlock timeBlock = new TimeBlock();
038                    timeBlock.setBeginTimestamp(new Timestamp(beginTime.getMillis()));
039                    timeBlock.setEndTimestamp(new Timestamp(endTime.getMillis()));
040    
041                    TimeHourDetail timeHourDetail = new TimeHourDetail();
042    
043                    Map<Timestamp, BigDecimal> timeToHrs = TkTestUtils.getDateToHoursMap(timeBlock, timeHourDetail);
044                    Assert.assertTrue(timeToHrs!=null);
045            }
046    
047    }