You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/11/08 18:51:51 UTC
[commons-numbers] 24/32: Fixed checkstyle in complex-streams.
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 2d0ef91daf9fe0509d9f7b68a0debf6d280ad62c
Author: aherbert <ah...@apache.org>
AuthorDate: Fri Nov 8 17:43:34 2019 +0000
Fixed checkstyle in complex-streams.
---
.../numbers/complex/streams/ComplexUtils.java | 30 ++++----
.../numbers/complex/streams/ComplexUtilsTest.java | 88 +++++++++++-----------
.../commons/numbers/complex/streams/TestUtils.java | 26 ++++---
3 files changed, 74 insertions(+), 70 deletions(-)
diff --git a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
index 66d72b5..304f9db 100644
--- a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
+++ b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
@@ -22,7 +22,7 @@ import org.apache.commons.numbers.complex.Complex;
/**
* Static implementations of common {@link Complex} utilities functions.
*/
-public class ComplexUtils {
+public final class ComplexUtils {
/**
* Utility class.
@@ -33,7 +33,7 @@ public class ComplexUtils {
* Creates a complex number from the given polar representation.
* <p>
* If either {@code r} or {@code theta} is NaN, or {@code theta} is
- * infinite, {@link Complex#NAN} is returned.
+ * infinite, {@code Complex(NaN, NaN)} is returned.
* <p>
* If {@code r} is infinite and {@code theta} is finite, infinite or NaN
* values may be returned in parts of the result, following the rules for
@@ -242,7 +242,7 @@ public class ComplexUtils {
* @return size 2 array.
*/
public static double[] extractInterleavedFromComplexArray(Complex[] complex, int index) {
- return new double[] { complex[index].getReal(), complex[index].getImaginary() };
+ return new double[] {complex[index].getReal(), complex[index].getImaginary()};
}
/**
@@ -254,7 +254,7 @@ public class ComplexUtils {
* @return size 2 {@code float[]}.
*/
public static float[] extractInterleavedFloatFromComplexArray(Complex[] complex, int index) {
- return new float[] { (float) complex[index].getReal(), (float) complex[index].getImaginary() };
+ return new float[] {(float) complex[index].getReal(), (float) complex[index].getImaginary()};
}
/**
@@ -714,7 +714,7 @@ public class ComplexUtils {
/**
* Converts a complex interleaved {@code double[]} array to a
- * {@code Complex[]} array
+ * {@code Complex[]} array.
*
* @param interleaved array of numbers to be converted to their {@code Complex} equivalent
* @return {@code Complex} array
@@ -730,7 +730,7 @@ public class ComplexUtils {
/**
* Converts a complex interleaved {@code float[]} array to a
- * {@code Complex[]} array
+ * {@code Complex[]} array.
*
* @param interleaved float[] array of numbers to be converted to their {@code Complex} equivalent
* @return {@code Complex} array
@@ -746,7 +746,7 @@ public class ComplexUtils {
/**
* Converts a {@code Complex[]} array to an interleaved complex
- * {@code double[]} array
+ * {@code double[]} array.
*
* @param c Complex array
* @return complex interleaved array alternating real and
@@ -767,7 +767,7 @@ public class ComplexUtils {
/**
* Converts a {@code Complex[]} array to an interleaved complex
- * {@code float[]} array
+ * {@code float[]} array.
*
* @param c Complex array
* @return complex interleaved {@code float[]} alternating real and
@@ -934,8 +934,8 @@ public class ComplexUtils {
for (int y = 0; y < h; y++) {
for (int z = 0; z < d; z++) {
for (int t = 0; t < v; t++) {
- i[x][y][z * 2][t] = c[x][y][z][t].getReal();
- i[x][y][z * 2 + 1][t] = c[x][y][z][t].getImaginary();
+ i[x][y][z * 2][t] = c[x][y][z][t].getReal();
+ i[x][y][z * 2 + 1][t] = c[x][y][z][t].getImaginary();
}
}
}
@@ -946,8 +946,8 @@ public class ComplexUtils {
for (int y = 0; y < h; y++) {
for (int z = 0; z < d; z++) {
for (int t = 0; t < v; t++) {
- i[x][y][z][t * 2] = c[x][y][z][t].getReal();
- i[x][y][z][t * 2 + 1] = c[x][y][z][t].getImaginary();
+ i[x][y][z][t * 2] = c[x][y][z][t].getReal();
+ i[x][y][z][t * 2 + 1] = c[x][y][z][t].getImaginary();
}
}
}
@@ -1329,7 +1329,7 @@ public class ComplexUtils {
Complex[][][] c;
if (interleavedDim == 0) {
c = new Complex[w / 2][h][d];
- for (int x = 0; x < w/2; x ++) {
+ for (int x = 0; x < w / 2; x++) {
for (int y = 0; y < h; y++) {
for (int z = 0; z < d; z++) {
c[x][y][z] = Complex.ofCartesian(i[x * 2][y][z], i[x * 2 + 1][y][z]);
@@ -1339,7 +1339,7 @@ public class ComplexUtils {
} else if (interleavedDim == 1) {
c = new Complex[w][h / 2][d];
for (int x = 0; x < w; x++) {
- for (int y = 0; y < h/2; y ++) {
+ for (int y = 0; y < h / 2; y++) {
for (int z = 0; z < d; z++) {
c[x][y][z] = Complex.ofCartesian(i[x][y * 2][z], i[x][y * 2 + 1][z]);
}
@@ -1349,7 +1349,7 @@ public class ComplexUtils {
c = new Complex[w][h][d / 2];
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
- for (int z = 0; z < d/2; z++) {
+ for (int z = 0; z < d / 2; z++) {
c[x][y][z] = Complex.ofCartesian(i[x][y][z * 2], i[x][y][z * 2 + 1]);
}
}
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
index daaa2e5..07b7a88 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
@@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test;
*/
public class ComplexUtilsTest {
+ // CHECKSTYLE: stop ConstantName
private static final double inf = Double.POSITIVE_INFINITY;
private static final double negInf = Double.NEGATIVE_INFINITY;
private static final double nan = Double.NaN;
@@ -54,6 +55,7 @@ public class ComplexUtilsTest {
private static float[] sfr; // real component of split array, float, evens
private static float[] sfi; // imag component of split array, float, odds
private static String msg; // error message for AssertEquals
+ // CHECKSTYLE: stop MultipleVariableDeclarations
private static Complex[][] c2d, cr2d, ci2d; // for 2d methods
private static Complex[][][] c3d, cr3d, ci3d; // for 3d methods
private static Complex[][][][] c4d, cr4d, ci4d; // for 3d methods
@@ -63,7 +65,10 @@ public class ComplexUtilsTest {
private static float[][] fi2d0, fi2d1, sfr2d, sfi2d;
private static float[][][] fi3d0, fi3d1, fi3d2, sfr3d, sfi3d;
private static float[][][][] sfr4d, sfi4d;
+ // CHECKSTYLE: resume MultipleVariableDeclarations
+ // CHECKSTYLE: resume ConstantName
+ // CHECKSTYLE: stop MethodLength
private static void setArrays() { // initial setup method
c = new Complex[10];
cr = new Complex[10];
@@ -231,6 +236,7 @@ public class ComplexUtilsTest {
}
msg = "";
}
+ // CHECKSTYLE: resume MethodLength
@Test
public void testPolar2Complex() {
@@ -261,8 +267,8 @@ public class ComplexUtilsTest {
}
theta1D[5] = 0;
for (int i = 1; i < 5; i++) {
- theta1D[5+i] = theta1D[5 + i - 1] + pi/6;
- theta1D[5-i] = theta1D[5 + i + 1] - pi/6;
+ theta1D[5 + i] = theta1D[5 + i - 1] + pi / 6;
+ theta1D[5 - i] = theta1D[5 + i + 1] - pi / 6;
}
Complex[] observed1D = ComplexUtils.polar2Complex(r1D, theta1D);
Assertions.assertEquals(r1D.length, observed1D.length);
@@ -310,28 +316,28 @@ public class ComplexUtilsTest {
@Test
public void testPolar2ComplexIllegalModulus() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.polar2Complex(-1, 0)
+ () -> ComplexUtils.polar2Complex(-1, 0)
);
}
@Test
public void testPolar2ComplexIllegalModulus1D() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.polar2Complex(new double[]{0, -1, 2}, new double[]{0, 1, 2})
+ () -> ComplexUtils.polar2Complex(new double[]{0, -1, 2}, new double[]{0, 1, 2})
);
}
@Test
public void testPolar2ComplexIllegalModulus2D() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.polar2Complex(new double[][]{{0, 2, 2}, {0, -1, 2}}, new double[][]{{0, 1, 2}, {0, 1, 2}})
+ () -> ComplexUtils.polar2Complex(new double[][]{{0, 2, 2}, {0, -1, 2}}, new double[][]{{0, 1, 2}, {0, 1, 2}})
);
}
@Test
public void testPolar2ComplexIllegalModulus3D() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.polar2Complex(new double[][][]{{{0, 2, 2}}, {{0, -1, 2}}}, new double[][][]{{{0, 1, 2}}, {{0, 1, 2}}})
+ () -> ComplexUtils.polar2Complex(new double[][][]{{{0, 2, 2}}, {{0, -1, 2}}}, new double[][][]{{{0, 1, 2}}, {{0, 1, 2}}})
);
}
@@ -357,7 +363,7 @@ public class ComplexUtilsTest {
@Test
public void testCExtract() {
- final double[] real = new double[] { negInf, -123.45, 0, 1, 234.56, pi, inf };
+ final double[] real = new double[] {negInf, -123.45, 0, 1, 234.56, pi, inf};
final Complex[] complex = ComplexUtils.real2Complex(real);
for (int i = 0; i < real.length; i++) {
@@ -395,10 +401,10 @@ public class ComplexUtilsTest {
// Extract complex from interleaved float array, index 3
TestUtils.assertSame(Complex.ofCartesian(6, 7), ComplexUtils.extractComplexFromInterleavedArray(f, 3));
// Extract interleaved double from complex array, index 3
- Assertions.assertArrayEquals(new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
+ Assertions.assertArrayEquals(new double[] {6, 7}, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
Math.ulp(1), msg);
// Extract interleaved float from complex array, index 3
- Assertions.assertArrayEquals(new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
+ Assertions.assertArrayEquals(new double[] {6, 7}, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
Math.ulp(1), msg);
}
// REAL <-> COMPLEX
@@ -504,101 +510,98 @@ public class ComplexUtilsTest {
@Test
public void testComplex2InterleavedIllegalIndex3Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2Interleaved(c3d, -1)
+ () -> ComplexUtils.complex2Interleaved(c3d, -1)
);
}
@Test
public void testComplex2InterleavedIllegalIndex3Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2Interleaved(c3d, 3)
+ () -> ComplexUtils.complex2Interleaved(c3d, 3)
);
}
@Test
public void testComplex2InterleavedIllegalIndex4Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2Interleaved(c4d, -1)
+ () -> ComplexUtils.complex2Interleaved(c4d, -1)
);
}
@Test
public void testComplex2InterleavedIllegalIndex4Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2Interleaved(c4d, 4)
+ () -> ComplexUtils.complex2Interleaved(c4d, 4)
);
}
@Test
public void testComplex2InterleavedFloatIllegalIndex2Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2InterleavedFloat(c2d, -1)
+ () -> ComplexUtils.complex2InterleavedFloat(c2d, -1)
);
}
@Test
public void testComplex2InterleavedFloatIllegalIndex2Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2InterleavedFloat(c2d, 2)
+ () -> ComplexUtils.complex2InterleavedFloat(c2d, 2)
);
}
@Test
- public void testComplex2InterleavedFloatIllegalIndex3Dmin()
- {
+ public void testComplex2InterleavedFloatIllegalIndex3Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2InterleavedFloat(c3d,-1)
+ () -> ComplexUtils.complex2InterleavedFloat(c3d, -1)
);
}
@Test
- public void testComplex2InterleavedFloatIllegalIndex3Dmax()
- {
+ public void testComplex2InterleavedFloatIllegalIndex3Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.complex2InterleavedFloat(c3d, 3)
+ () -> ComplexUtils.complex2InterleavedFloat(c3d, 3)
);
}
@Test
public void testInterleaved2ComplexIllegalIndex2Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di2d0, -1)
+ () -> ComplexUtils.interleaved2Complex(di2d0, -1)
);
}
@Test
public void testInterleaved2ComplexIllegalIndex2Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di2d0, 2)
+ () -> ComplexUtils.interleaved2Complex(di2d0, 2)
);
}
@Test
public void testInterleaved2ComplexIllegalIndex3Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di3d0, -1)
+ () -> ComplexUtils.interleaved2Complex(di3d0, -1)
);
}
@Test
- public void testInterleaved2ComplexIllegalIndex3Dmax()
- {
+ public void testInterleaved2ComplexIllegalIndex3Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di3d0, 3)
+ () -> ComplexUtils.interleaved2Complex(di3d0, 3)
);
}
@Test
public void testInterleaved2ComplexIllegalIndex4Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di4d0, -1)
+ () -> ComplexUtils.interleaved2Complex(di4d0, -1)
);
}
@Test
public void testInterleaved2ComplexIllegalIndex4Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(di4d0, 4)
+ () -> ComplexUtils.interleaved2Complex(di4d0, 4)
);
}
@@ -612,22 +615,21 @@ public class ComplexUtilsTest {
@Test
public void testInterleaved2ComplexFloatIllegalIndex2Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(fi2d0, 2)
+ () -> ComplexUtils.interleaved2Complex(fi2d0, 2)
);
}
@Test
public void testInterleaved2ComplexFloatIllegalIndex3Dmin() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(fi3d0, -1)
+ () -> ComplexUtils.interleaved2Complex(fi3d0, -1)
);
}
@Test
- public void testInterleaved2ComplexFloatIllegalIndex3Dmax()
- {
+ public void testInterleaved2ComplexFloatIllegalIndex3Dmax() {
Assertions.assertThrows(IllegalArgumentException.class,
- () -> ComplexUtils.interleaved2Complex(fi3d0, 3)
+ () -> ComplexUtils.interleaved2Complex(fi3d0, 3)
);
}
@@ -719,18 +721,18 @@ public class ComplexUtilsTest {
@Test
public void testInitialize() {
- Complex[] c = new Complex[10];
- ComplexUtils.initialize(c);
- for (Complex cc : c) {
+ Complex[] complexes = new Complex[10];
+ ComplexUtils.initialize(complexes);
+ for (Complex cc : complexes) {
TestUtils.assertEquals(Complex.ofCartesian(0, 0), cc, Math.ulp(0));
}
}
@Test
public void testInitialize2d() {
- Complex[][] c = new Complex[10][10];
- ComplexUtils.initialize(c);
- for (Complex[] c1 : c) {
+ Complex[][] complexes = new Complex[10][10];
+ ComplexUtils.initialize(complexes);
+ for (Complex[] c1 : complexes) {
for (Complex c0 : c1) {
TestUtils.assertEquals(Complex.ofCartesian(0, 0), c0, Math.ulp(0));
}
@@ -739,9 +741,9 @@ public class ComplexUtilsTest {
@Test
public void testInitialize3d() {
- Complex[][][] c = new Complex[10][10][10];
- ComplexUtils.initialize(c);
- for (Complex[][] c2 : c) {
+ Complex[][][] complexes = new Complex[10][10][10];
+ ComplexUtils.initialize(complexes);
+ for (Complex[][] c2 : complexes) {
for (Complex[] c1 : c2) {
for (Complex c0 : c1) {
TestUtils.assertEquals(Complex.ofCartesian(0, 0), c0, Math.ulp(0));
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
index 30de90e..0b3ff66 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.Assertions;
* Test utilities.
*/
@SuppressWarnings("WeakerAccess")
-class TestUtils {
+final class TestUtils {
/**
* Collection of static methods used in math unit tests.
*/
@@ -87,7 +87,7 @@ class TestUtils {
/** verifies that two 2D arrays are close (sup norm) */
public static void assertEquals(String msg, double[][] expected, double[][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
Assertions.assertArrayEquals(expected[i], observed[i], tolerance, msg + "[" + i + "]");
}
}
@@ -95,7 +95,7 @@ class TestUtils {
/** verifies that two 3D arrays are close (sup norm) */
public static void assertEquals(String msg, double[][][] expected, double[][][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -103,7 +103,7 @@ class TestUtils {
/** verifies that two 4D arrays are close (sup norm) */
public static void assertEquals(String msg, double[][][][] expected, double[][][][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -111,7 +111,7 @@ class TestUtils {
/** verifies that two 4D arrays are close (sup norm) */
public static void assertEquals(String msg, float[][][][] expected, float[][][][] observed, float tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -119,7 +119,7 @@ class TestUtils {
/** verifies that two 2D arrays are close (sup norm) */
public static void assertEquals(String msg, float[][] expected, float[][] observed, float tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
Assertions.assertArrayEquals(expected[i], observed[i], tolerance, msg + "[" + i + "]");
}
}
@@ -127,7 +127,7 @@ class TestUtils {
/** verifies that two 3D arrays are close (sup norm) */
public static void assertEquals(String msg, float[][][] expected, float[][][] observed, float tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -137,7 +137,7 @@ class TestUtils {
assertArrayLengthsEqual(msg, expected.length, observed.length);
StringBuilder out = new StringBuilder(msg);
boolean failure = false;
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
if (!Precision.equalsIncludingNaN(expected[i].getReal(), observed[i].getReal(), tolerance)) {
failure = true;
out.append("\n[").append(i).append("] ");
@@ -165,7 +165,7 @@ class TestUtils {
/** verifies that two 2D arrays are close (sup norm) */
public static void assertEquals(String msg, Complex[][] expected, Complex[][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -173,7 +173,7 @@ class TestUtils {
/** verifies that two 3D arrays are close (sup norm) */
public static void assertEquals(String msg, Complex[][][] expected, Complex[][][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -181,7 +181,7 @@ class TestUtils {
/** verifies that two 4D arrays are close (sup norm) */
public static void assertEquals(String msg, Complex[][][][] expected, Complex[][][][] observed, double tolerance) {
assertArrayLengthsEqual(msg, expected.length, observed.length);
- for (int i=0; i < expected.length; i++) {
+ for (int i = 0; i < expected.length; i++) {
assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
}
}
@@ -195,7 +195,9 @@ class TestUtils {
private static void assertArrayLengthsEqual(String msg, int expectedLength, int observedLength) {
if (expectedLength != observedLength) {
StringBuilder out = new StringBuilder(msg);
- if (msg != null && msg.length()>0) out.append("\n");
+ if (msg != null && msg.length() > 0) {
+ out.append("\n");
+ }
out.append("Arrays not same length. \n");
out.append("expected has length ").append(expectedLength);
out.append(" observed has length = ").append(observedLength);