You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VersionTest.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/epl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.bridge;
  14. import java.text.SimpleDateFormat;
  15. import java.util.Date;
  16. import java.util.Locale;
  17. import java.util.TimeZone;
  18. import org.aspectj.util.LangUtil;
  19. import junit.framework.TestCase;
  20. import junit.textui.TestRunner;
  21. /**
  22. *
  23. */
  24. public class VersionTest extends TestCase {
  25. private static final String ME = "org.aspectj.bridge.VersionTest";
  26. /** @param args ignored */
  27. public static void main(String[] args) {
  28. TestRunner.main(new String[] { ME });
  29. }
  30. /**
  31. * Constructor for MessageTest.
  32. *
  33. * @param name
  34. */
  35. public VersionTest(String name) {
  36. super(name);
  37. }
  38. public void testVersion() {
  39. if (LangUtil.is11VMOrGreater()) {
  40. return;
  41. }
  42. if (Version.getTimeText().equals("")) {
  43. return; // dev build, we can only test this on the build server.
  44. }
  45. Date date = new Date(Version.getTime());
  46. SimpleDateFormat format = new SimpleDateFormat(Version.SIMPLE_DATE_FORMAT, Locale.getDefault());
  47. format.setTimeZone(TimeZone.getTimeZone("PST"));
  48. String timeString = format.format(date);
  49. assertEquals(Version.getTimeText(), timeString);
  50. }
  51. }