Remove test wildcard imports

This patch applies the de-facto project's coding standard on the test
files and replaces wildcard static imports with series of single
method imports.
This commit is contained in:
Allon Mureinik 2017-03-14 11:45:03 +02:00 committed by pascalschumacher
parent bf80b9e280
commit 6bc8650ed4
27 changed files with 135 additions and 43 deletions

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import org.junit.Test;

View File

@ -16,13 +16,16 @@
*/
package org.apache.commons.lang3;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import org.junit.Assert;
import org.junit.Test;
/**
@ -47,27 +50,27 @@ public class CharSequenceUtilsTest {
//
// null input
//
Assert.assertEquals(null, CharSequenceUtils.subSequence(null, -1));
Assert.assertEquals(null, CharSequenceUtils.subSequence(null, 0));
Assert.assertEquals(null, CharSequenceUtils.subSequence(null, 1));
assertEquals(null, CharSequenceUtils.subSequence(null, -1));
assertEquals(null, CharSequenceUtils.subSequence(null, 0));
assertEquals(null, CharSequenceUtils.subSequence(null, 1));
//
// non-null input
//
Assert.assertEquals(StringUtils.EMPTY, CharSequenceUtils.subSequence(StringUtils.EMPTY, 0));
Assert.assertEquals("012", CharSequenceUtils.subSequence("012", 0));
Assert.assertEquals("12", CharSequenceUtils.subSequence("012", 1));
Assert.assertEquals("2", CharSequenceUtils.subSequence("012", 2));
Assert.assertEquals(StringUtils.EMPTY, CharSequenceUtils.subSequence("012", 3));
assertEquals(StringUtils.EMPTY, CharSequenceUtils.subSequence(StringUtils.EMPTY, 0));
assertEquals("012", CharSequenceUtils.subSequence("012", 0));
assertEquals("12", CharSequenceUtils.subSequence("012", 1));
assertEquals("2", CharSequenceUtils.subSequence("012", 2));
assertEquals(StringUtils.EMPTY, CharSequenceUtils.subSequence("012", 3));
}
@Test(expected=IndexOutOfBoundsException.class)
public void testSubSequenceNegativeStart() {
Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, -1));
assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, -1));
}
@Test(expected=IndexOutOfBoundsException.class)
public void testSubSequenceTooLong() {
Assert.assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, 1));
assertEquals(null, CharSequenceUtils.subSequence(StringUtils.EMPTY, 1));
}
static class TestData{
@ -142,15 +145,15 @@ public class CharSequenceUtilsTest {
if (data.throwable != null) {
try {
invoke();
Assert.fail(id + " Expected " + data.throwable);
fail(id + " Expected " + data.throwable);
} catch (final Exception e) {
if (!e.getClass().equals(data.throwable)) {
Assert.fail(id + " Expected " + data.throwable + " got " + e.getClass());
fail(id + " Expected " + data.throwable + " got " + e.getClass());
}
}
} else {
final boolean stringCheck = invoke();
Assert.assertEquals(id + " Failed test " + data, data.expected, stringCheck);
assertEquals(id + " Failed test " + data, data.expected, stringCheck);
}
}

View File

@ -21,7 +21,9 @@ package org.apache.commons.lang3;
import org.junit.Test;
import static org.apache.commons.lang3.JavaVersion.JAVA_RECENT;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.apache.commons.lang3.JavaVersion.JAVA_0_9;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_1;
import static org.apache.commons.lang3.JavaVersion.JAVA_1_2;

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.apache.commons.lang3.text.StrBuilder;
/**

View File

@ -16,7 +16,14 @@
*/
package org.apache.commons.lang3;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;

View File

@ -17,7 +17,7 @@
package org.apache.commons.lang3.builder;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;

View File

@ -18,7 +18,13 @@ package org.apache.commons.lang3.concurrent;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;

View File

@ -19,7 +19,8 @@ package org.apache.commons.lang3.exception;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.Serializable;
import java.util.Arrays;

View File

@ -18,7 +18,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -17,7 +17,10 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* JUnit tests.

View File

@ -16,8 +16,13 @@
*/
package org.apache.commons.lang3.mutable;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* JUnit tests.

View File

@ -17,7 +17,11 @@
package org.apache.commons.lang3.mutable;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* JUnit tests.

View File

@ -17,7 +17,15 @@
package org.apache.commons.lang3.reflect;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.reflect.testbed.*;
import org.apache.commons.lang3.reflect.testbed.Ambig;
import org.apache.commons.lang3.reflect.testbed.Annotated;
import org.apache.commons.lang3.reflect.testbed.Foo;
import org.apache.commons.lang3.reflect.testbed.PrivatelyShadowedChild;
import org.apache.commons.lang3.reflect.testbed.PublicChild;
import org.apache.commons.lang3.reflect.testbed.PubliclyShadowedChild;
import org.apache.commons.lang3.reflect.testbed.StaticContainer;
import org.apache.commons.lang3.reflect.testbed.StaticContainerChild;
import org.junit.Before;
import org.junit.Test;
@ -28,7 +36,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNotNull;
/**

View File

@ -18,7 +18,9 @@
package org.apache.commons.lang3.text;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;

View File

@ -18,7 +18,10 @@ package org.apache.commons.lang3.text;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.text.DateFormat;
import java.text.FieldPosition;

View File

@ -18,7 +18,9 @@
package org.apache.commons.lang3.text;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.text.DecimalFormatSymbols;
import java.util.Arrays;

View File

@ -18,7 +18,14 @@
package org.apache.commons.lang3.text;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.io.Reader;

View File

@ -19,7 +19,11 @@ package org.apache.commons.lang3.text;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.Collections;

View File

@ -16,7 +16,10 @@
*/
package org.apache.commons.lang3.text;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;

View File

@ -18,7 +18,7 @@
package org.apache.commons.lang3.text.translate;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Unit tests for {@link org.apache.commons.lang3.text.translate.OctalUnescaper}.

View File

@ -16,7 +16,7 @@
*/
package org.apache.commons.lang3.text.translate;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import java.io.CharArrayWriter;
import java.io.IOException;

View File

@ -18,7 +18,9 @@ package org.apache.commons.lang3.time;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.Calendar;
import java.util.Date;

View File

@ -18,7 +18,10 @@ package org.apache.commons.lang3.time;
import org.junit.Test;
import org.junit.Before;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;