01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tcclient.cache;
05:
06: import java.util.Calendar;
07:
08: import junit.framework.TestCase;
09:
10: public class TimestampTest extends TestCase {
11:
12: private long startTime() {
13: Calendar cal = Calendar.getInstance();
14: cal.set(0, 1, 107);
15: return cal.getTimeInMillis();
16: }
17:
18: public void test() {
19: long start = startTime();
20: long maxIdle = 10 * 1000;
21: long maxTTL = 20 * 1000;
22: Timestamp t = new Timestamp(start, maxIdle, maxTTL);
23: assertEquals(start + maxIdle, t.getInvalidatedTimeMillis());
24: assertEquals(start + maxIdle, t.getExpiredTimeMillis());
25: }
26:
27: }
|