UUIDGeneratorTest.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.maxkey.util;
  17. import java.util.Date;
  18. //import java.util.UUID;
  19. import org.maxkey.uuid.UUID;
  20. import org.junit.Test;
  21. public class UUIDGeneratorTest {
  22. @Test
  23. public void test() {
  24. Date sd=new Date();
  25. //for(int i=0;i<100000;i++){
  26. UUIDGenerator generated=new UUIDGenerator();
  27. generated.toString();
  28. //System.out.println(generated.toString());
  29. //}
  30. Date ed=new Date();
  31. System.out.println("usertime "+(ed.getTime()-sd.getTime()));
  32. // UUIDGenerator.version(generated);
  33. System.out.println("JDK UUID");
  34. Date ssd=new Date();
  35. // for(int i=0;i<100000;i++){
  36. //UUID.randomUUID().toString();
  37. UUID.generate().toString();
  38. // System.out.println(UUID.randomUUID().toString());
  39. //}
  40. Date sed=new Date();
  41. System.out.println("usertime "+(sed.getTime()-ssd.getTime()));
  42. UUIDGenerator.version(new UUIDGenerator(UUID.generate().toString()));
  43. }
  44. }