Author: tv
Date: Mon Jan 23 15:21:51 2017
New Revision: 1779942

URL: http://svn.apache.org/viewvc?rev=1779942&view=rev
Log:
Add test for ElementAttributes.clone()

Modified:
    
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/event/SimpleEventHandlingUnitTest.java

Modified: 
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/event/SimpleEventHandlingUnitTest.java?rev=1779942&r1=1779941&r2=1779942&view=diff
==============================================================================
--- 
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
 (original)
+++ 
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/control/event/SimpleEventHandlingUnitTest.java
 Mon Jan 23 15:21:51 2017
@@ -1,5 +1,12 @@
 package org.apache.commons.jcs.engine.control.event;
 
+import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.engine.ElementAttributes;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
+import org.apache.commons.jcs.engine.control.event.behavior.IElementEvent;
+import 
org.apache.commons.jcs.engine.control.event.behavior.IElementEventHandler;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -21,12 +28,6 @@ package org.apache.commons.jcs.engine.co
 
 import junit.framework.TestCase;
 
-import org.apache.commons.jcs.JCS;
-import org.apache.commons.jcs.access.CacheAccess;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
-import org.apache.commons.jcs.engine.control.event.behavior.IElementEvent;
-import 
org.apache.commons.jcs.engine.control.event.behavior.IElementEventHandler;
-
 /**
  * This test suite verifies that the basic ElementEvent are called as they 
should be.
  */
@@ -256,6 +257,24 @@ public class SimpleEventHandlingUnitTest
     }
 
     /**
+     * Test that cloned ElementAttributes have different creation times.
+     * @throws Exception
+     */
+    public void testElementAttributesCreationTime()
+        throws Exception
+    {
+       ElementAttributes elem1 = new ElementAttributes();
+       long ctime1 = elem1.getCreateTime();
+       
+       Thread.sleep(10);
+
+       IElementAttributes elem2 = elem1.clone();
+       long ctime2 = elem2.getCreateTime();
+       
+       assertFalse("Creation times should be different", ctime1 == ctime2);
+    }
+    
+    /**
      * Simple event counter used to verify test results.
      */
     public static class MyEventHandler


Reply via email to