You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2011/01/30 08:54:29 UTC

svn commit: r1065212 - in /commons/proper/lang/trunk: pom.xml src/test/java/org/apache/commons/lang3/JavaVersionTest.java

Author: bayard
Date: Sun Jan 30 07:54:29 2011
New Revision: 1065212

URL: http://svn.apache.org/viewvc?rev=1065212&view=rev
Log:
Adding unit test for JavaVersion

Added:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java   (with props)
Modified:
    commons/proper/lang/trunk/pom.xml

Modified: commons/proper/lang/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1065212&r1=1065211&r2=1065212&view=diff
==============================================================================
--- commons/proper/lang/trunk/pom.xml (original)
+++ commons/proper/lang/trunk/pom.xml Sun Jan 30 07:54:29 2011
@@ -27,7 +27,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-lang3</artifactId>
-  <version>3.0-SNAPSHOT</version>
+  <version>3.0</version>
   <name>Commons Lang</name>
 
   <inceptionYear>2001</inceptionYear>

Added: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java?rev=1065212&view=auto
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java (added)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java Sun Jan 30 07:54:29 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.commons.lang3;
+
+import static org.apache.commons.lang3.JavaVersion.*;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit tests {@link org.apache.commons.lang3.JavaVersion}.
+ *
+ * @author Apache Software Foundation
+ * @version $Id: JavaVersionTest.java 918366 2010-03-03 08:56:22Z bayard $
+ */
+public class JavaVersionTest extends TestCase {
+
+    public void testGetJavaVersion() {
+        assertEquals("0.9 failed", JAVA_0_9, get("0.9"));
+        assertEquals("1.1 failed", JAVA_1_1, get("1.1"));
+        assertEquals("1.2 failed", JAVA_1_2, get("1.2"));
+        assertEquals("1.3 failed", JAVA_1_3, get("1.3"));
+        assertEquals("1.4 failed", JAVA_1_4, get("1.4"));
+        assertEquals("1.5 failed", JAVA_1_5, get("1.5"));
+        assertEquals("1.6 failed", JAVA_1_6, get("1.6"));
+        assertEquals("1.7 failed", JAVA_1_7, get("1.7"));
+    }
+
+    public void testAtLeast() {
+        assertFalse("1.2 at least 1.5 passed", JAVA_1_2.atLeast(JAVA_1_5));
+        assertTrue("1.5 at least 1.2 failed", JAVA_1_5.atLeast(JAVA_1_2));
+        assertFalse("1.6 at least 1.7 passed", JAVA_1_6.atLeast(JAVA_1_7));
+
+        assertTrue("0.9 at least 1.5 failed", JAVA_0_9.atLeast(JAVA_1_5));
+        assertFalse("0.9 at least 1.6 passed", JAVA_0_9.atLeast(JAVA_1_6));
+    }
+
+}

Propchange: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/JavaVersionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native