KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > util > zip > ZipEntryTest


1 /*
2  * ZipEntryTest.java
3  * JUnit based test
4  *
5  * Created on 4. Juli 2005, 15:40
6  */

7 /*
8  * Copyright 2005 Schlichtherle IT Services
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */

22
23 package de.schlichtherle.util.zip;
24
25 import junit.framework.*;
26 import java.util.Calendar JavaDoc;
27 import java.util.Date JavaDoc;
28
29 /**
30  * @author Christian Schlichtherle
31  */

32 public class ZipEntryTest extends TestCase {
33     
34     private ZipEntry ze;
35     
36     public ZipEntryTest(String JavaDoc testName) {
37         super(testName);
38     }
39
40     protected void setUp() throws Exception JavaDoc {
41         ze = new ZipEntry("test");
42     }
43
44     protected void tearDown() throws Exception JavaDoc {
45         ze = null;
46     }
47
48     /**
49      * Test of setTime method, of class net.sf.jazzlib.ZipEntry.
50      */

51     public void testSetTime() {
52         System.out.println("testSetTime");
53         final long time = 0; //System.currentTimeMillis();
54
ze.setTime(time);
55         final long time2 = ze.getTime();
56         // FIXME: This does not work in other time zones!!!
57
assertEquals("01.01.1970 01:00:00 CET",
58                 java.text.MessageFormat.format("{0,date} {0,time,long}",
59                     new Object JavaDoc[] { new Date JavaDoc(time) }));
60         assertEquals("01.01.1980 00:00:00 CET",
61                 java.text.MessageFormat.format("{0,date} {0,time,long}",
62                     new Object JavaDoc[] { new Date JavaDoc(time2) }));
63     }
64 }
65
Popular Tags