001/* 002 * Copyright 2011 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.ole; 017 018import org.junit.Test; 019import org.kuali.ole.utility.DateTimeUtil; 020import org.slf4j.Logger; 021import org.slf4j.LoggerFactory; 022 023import static junit.framework.Assert.assertNotNull; 024 025/** 026 * Created by IntelliJ IDEA. 027 * User: peris 028 * Date: 7/22/11 029 * Time: 2:37 PM 030 * To change this template use File | Settings | File Templates. 031 */ 032public class DateTimeUtil_UT 033 extends BaseTestCase { 034 private static Logger LOG = LoggerFactory.getLogger(DateTimeUtil_UT.class); 035 036 @Test 037 public void testFormatTime() throws Exception { 038 long startTime = System.currentTimeMillis(); 039 Thread.sleep(20); 040 long endTime = System.currentTimeMillis(); 041 String formattedTime = DateTimeUtil.formatTime(endTime - startTime); 042 assertNotNull(formattedTime); 043 LOG.info(formattedTime); 044 } 045 046 @Test 047 public void testFormatTime1() throws Exception { 048 long startTime = System.currentTimeMillis(); 049 Thread.sleep(10); 050 long endTime = System.currentTimeMillis(); 051 052 String formattedTime = DateTimeUtil.formatTime(endTime, startTime); 053 assertNotNull(formattedTime); 054 LOG.info(formattedTime); 055 } 056}