You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/07/19 00:16:33 UTC

svn commit: r1504687 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java

Author: sebb
Date: Thu Jul 18 22:16:33 2013
New Revision: 1504687

URL: http://svn.apache.org/r1504687
Log:
Simplify: no need to unbox the Integers just to compare values

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java?rev=1504687&r1=1504686&r2=1504687&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/genetics/OnePointCrossoverTest.java Thu Jul 18 22:16:33 2013
@@ -23,7 +23,9 @@ public class OnePointCrossoverTest {
 
     @Test
     public void testCrossover() {
+        @SuppressWarnings("boxing")
         Integer[] p1 = new Integer[] {1,0,1,0,0,1,0,1,1};
+        @SuppressWarnings("boxing")
         Integer[] p2 = new Integer[] {0,1,1,0,1,0,1,1,1};
 
         BinaryChromosome p1c = new DummyBinaryChromosome(p1);
@@ -42,17 +44,17 @@ public class OnePointCrossoverTest {
             c2 = ((BinaryChromosome) pair.getSecond()).getRepresentation().toArray(c2);
 
             // first and last values will be the same
-            Assert.assertEquals((int) p1[0], (int) c1[0]);
-            Assert.assertEquals((int) p2[0], (int) c2[0]);
-            Assert.assertEquals((int) p1[p1.length-1], (int) c1[c1.length-1]);
-            Assert.assertEquals((int) p2[p2.length-1], (int) c2[c2.length-1]);
+            Assert.assertEquals(p1[0],  c1[0]);
+            Assert.assertEquals(p2[0], c2[0]);
+            Assert.assertEquals(p1[p1.length-1], c1[c1.length-1]);
+            Assert.assertEquals(p2[p2.length-1], c2[c2.length-1]);
             // moreover, in the above setting, the 2nd, 3rd and 7th values will be the same
-            Assert.assertEquals((int) p1[2], (int) c1[2]);
-            Assert.assertEquals((int) p2[2], (int) c2[2]);
-            Assert.assertEquals((int) p1[3], (int) c1[3]);
-            Assert.assertEquals((int) p2[3], (int) c2[3]);
-            Assert.assertEquals((int) p1[7], (int) c1[7]);
-            Assert.assertEquals((int) p2[7], (int) c2[7]);
+            Assert.assertEquals(p1[2], c1[2]);
+            Assert.assertEquals(p2[2], c2[2]);
+            Assert.assertEquals(p1[3], c1[3]);
+            Assert.assertEquals(p2[3], c2[3]);
+            Assert.assertEquals(p1[7], c1[7]);
+            Assert.assertEquals(p2[7], c2[7]);
         }
     }