1 8 package test; 9 10 import junit.framework.Test; 11 import junit.framework.TestCase; 12 import junit.framework.TestSuite; 13 import junit.textui.TestRunner; 14 import org.codehaus.aspectwerkz.util.UuidGenerator; 15 16 19 public class UUIDTest extends TestCase { 20 private int m_numberOfInvocations = 1000000; 21 22 public UUIDTest(String name) { 23 super(name); 24 } 25 26 public void testPerformance() { 27 long startTime = System.currentTimeMillis(); 28 for (int i = 0; i < m_numberOfInvocations; i++) { 29 String uuid = UuidGenerator.generate(this); 30 } 31 long time = System.currentTimeMillis() - startTime; 32 double timePerUuidGenaration = time / (double) m_numberOfInvocations; 33 } 34 35 public static void main(String [] args) { 36 TestRunner.run(suite()); 37 } 38 39 public static Test suite() { 40 return new TestSuite(UUIDTest.class); 41 } 42 } | Popular Tags |