Skip to content

Commit

Permalink
[FLINK-1218] Replace new Integer with Integer.valueOf in tests
Browse files Browse the repository at this point in the history
This closes apache#183.
  • Loading branch information
sarutak authored and uce committed Nov 13, 2014
1 parent 9ff2e5b commit c339c26
Show file tree
Hide file tree
Showing 49 changed files with 207 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,53 +89,53 @@ public void testPrimitiveTypes() {
testObjectSerialization(new Boolean(true));
testObjectSerialization(new Boolean(false));

testObjectSerialization(new Byte((byte) 0));
testObjectSerialization(new Byte((byte) 1));
testObjectSerialization(new Byte((byte) -1));
testObjectSerialization(new Byte(Byte.MIN_VALUE));
testObjectSerialization(new Byte(Byte.MAX_VALUE));
testObjectSerialization(Byte.valueOf((byte) 0));
testObjectSerialization(Byte.valueOf((byte) 1));
testObjectSerialization(Byte.valueOf((byte) -1));
testObjectSerialization(Byte.valueOf(Byte.MIN_VALUE));
testObjectSerialization(Byte.valueOf(Byte.MAX_VALUE));

testObjectSerialization(new Short((short) 0));
testObjectSerialization(new Short((short) 1));
testObjectSerialization(new Short((short) -1));
testObjectSerialization(new Short(Short.MIN_VALUE));
testObjectSerialization(new Short(Short.MAX_VALUE));
testObjectSerialization(Short.valueOf((short) 0));
testObjectSerialization(Short.valueOf((short) 1));
testObjectSerialization(Short.valueOf((short) -1));
testObjectSerialization(Short.valueOf(Short.MIN_VALUE));
testObjectSerialization(Short.valueOf(Short.MAX_VALUE));

testObjectSerialization(new Integer(0));
testObjectSerialization(new Integer(1));
testObjectSerialization(new Integer(-1));
testObjectSerialization(new Integer(Integer.MIN_VALUE));
testObjectSerialization(new Integer(Integer.MAX_VALUE));
testObjectSerialization(Integer.valueOf(0));
testObjectSerialization(Integer.valueOf(1));
testObjectSerialization(Integer.valueOf(-1));
testObjectSerialization(Integer.valueOf(Integer.MIN_VALUE));
testObjectSerialization(Integer.valueOf(Integer.MAX_VALUE));

testObjectSerialization(new Long(0));
testObjectSerialization(new Long(1));
testObjectSerialization(new Long(-1));
testObjectSerialization(new Long(Long.MIN_VALUE));
testObjectSerialization(new Long(Long.MAX_VALUE));
testObjectSerialization(Long.valueOf(0));
testObjectSerialization(Long.valueOf(1));
testObjectSerialization(Long.valueOf(-1));
testObjectSerialization(Long.valueOf(Long.MIN_VALUE));
testObjectSerialization(Long.valueOf(Long.MAX_VALUE));

testObjectSerialization(new Float(0));
testObjectSerialization(new Float(1));
testObjectSerialization(new Float(-1));
testObjectSerialization(new Float((float)Math.E));
testObjectSerialization(new Float((float)Math.PI));
testObjectSerialization(new Float(Float.MIN_VALUE));
testObjectSerialization(new Float(Float.MAX_VALUE));
testObjectSerialization(new Float(Float.MIN_NORMAL));
testObjectSerialization(new Float(Float.NaN));
testObjectSerialization(new Float(Float.NEGATIVE_INFINITY));
testObjectSerialization(new Float(Float.POSITIVE_INFINITY));
testObjectSerialization(Float.valueOf(0));
testObjectSerialization(Float.valueOf(1));
testObjectSerialization(Float.valueOf(-1));
testObjectSerialization(Float.valueOf((float)Math.E));
testObjectSerialization(Float.valueOf((float)Math.PI));
testObjectSerialization(Float.valueOf(Float.MIN_VALUE));
testObjectSerialization(Float.valueOf(Float.MAX_VALUE));
testObjectSerialization(Float.valueOf(Float.MIN_NORMAL));
testObjectSerialization(Float.valueOf(Float.NaN));
testObjectSerialization(Float.valueOf(Float.NEGATIVE_INFINITY));
testObjectSerialization(Float.valueOf(Float.POSITIVE_INFINITY));

testObjectSerialization(new Double(0));
testObjectSerialization(new Double(1));
testObjectSerialization(new Double(-1));
testObjectSerialization(new Double(Math.E));
testObjectSerialization(new Double(Math.PI));
testObjectSerialization(new Double(Double.MIN_VALUE));
testObjectSerialization(new Double(Double.MAX_VALUE));
testObjectSerialization(new Double(Double.MIN_NORMAL));
testObjectSerialization(new Double(Double.NaN));
testObjectSerialization(new Double(Double.NEGATIVE_INFINITY));
testObjectSerialization(new Double(Double.POSITIVE_INFINITY));
testObjectSerialization(Double.valueOf(0));
testObjectSerialization(Double.valueOf(1));
testObjectSerialization(Double.valueOf(-1));
testObjectSerialization(Double.valueOf(Math.E));
testObjectSerialization(Double.valueOf(Math.PI));
testObjectSerialization(Double.valueOf(Double.MIN_VALUE));
testObjectSerialization(Double.valueOf(Double.MAX_VALUE));
testObjectSerialization(Double.valueOf(Double.MIN_NORMAL));
testObjectSerialization(Double.valueOf(Double.NaN));
testObjectSerialization(Double.valueOf(Double.NEGATIVE_INFINITY));
testObjectSerialization(Double.valueOf(Double.POSITIVE_INFINITY));

testObjectSerialization("");
testObjectSerialization("abcdefg");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public class DBStateTest {

public void stateTest(DBState<String, Integer> state) {
state.put("k1", 1);
assertEquals(new Integer(1), state.get("k1"));
assertEquals(Integer.valueOf(1), state.get("k1"));

state.put("k2", 2);
state.put("k3", 3);
assertEquals(new Integer(2), state.get("k2"));
assertEquals(new Integer(3), state.get("k3"));
assertEquals(Integer.valueOf(2), state.get("k2"));
assertEquals(Integer.valueOf(3), state.get("k3"));
state.remove("k2");

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ public WindowDataStream<OUT> window(long windowSize) {
*/
public SingleOutputStreamOperator<Long, ?> count() {
TypeWrapper<OUT> inTypeWrapper = outTypeWrapper;
TypeWrapper<Long> outTypeWrapper = new ObjectTypeWrapper<Long>(new Long(0));
TypeWrapper<Long> outTypeWrapper = new ObjectTypeWrapper<Long>(Long.valueOf(0));

return addFunction("counter", null, inTypeWrapper, outTypeWrapper,
new CounterInvokable<OUT>());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void reduce(Iterable<Double> values, Collector<Double> out) throws Except
count++;
}
if (count > 0) {
out.collect(new Double(sum / count));
out.collect(Double.valueOf(sum / count));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void functionTypeSerializationTest() {
@SuppressWarnings("unchecked")
@Test
public void objectTypeSerializationTest() {
Integer instance = new Integer(22);
Integer instance = Integer.valueOf(22);

TypeWrapper<Integer> ser = new ObjectTypeWrapper<Integer>(instance);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testFieldListConstructors() {
check(new FieldList());
check(FieldList.EMPTY_LIST);
check(new FieldList(14), 14);
check(new FieldList(new Integer(3)), 3);
check(new FieldList(Integer.valueOf(3)), 3);
check(new FieldList(7, 4, 1), 7, 4, 1);
check(new FieldList(7, 4, 1, 4, 7, 1, 4, 2), 7, 4, 1, 4, 7, 1, 4, 2);
}
Expand All @@ -55,14 +55,14 @@ public void testFieldListAdds() {
public void testImmutability() {
FieldList s1 = new FieldList();
FieldList s2 = new FieldList(5);
FieldList s3 = new FieldList(new Integer(7));
FieldList s3 = new FieldList(Integer.valueOf(7));
FieldList s4 = new FieldList(5, 4, 7, 6);

s1.addFields(s2).addFields(s3);
s2.addFields(s4);
s4.addFields(s1);

s1.addField(new Integer(14));
s1.addField(Integer.valueOf(14));
s2.addFields(78, 13, 66, 3);

assertEquals(0, s1.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testFieldSetConstructors() {
check(new FieldSet());
check(FieldSet.EMPTY_SET);
check(new FieldSet(14), 14);
check(new FieldSet(new Integer(3)), 3);
check(new FieldSet(Integer.valueOf(3)), 3);
check(new FieldSet(7, 4, 1), 1, 4, 7);
check(new FieldSet(7, 4, 1, 4, 7, 1, 4, 2), 1, 4, 2, 7);
}
Expand All @@ -58,14 +58,14 @@ public void testFieldSetAdds() {
public void testImmutability() {
FieldSet s1 = new FieldSet();
FieldSet s2 = new FieldSet(5);
FieldSet s3 = new FieldSet(new Integer(7));
FieldSet s3 = new FieldSet(Integer.valueOf(7));
FieldSet s4 = new FieldSet(5, 4, 7, 6);

s1.addFields(s2).addFields(s3);
s2.addFields(s4);
s4.addFields(s1);

s1.addField(new Integer(14));
s1.addField(Integer.valueOf(14));
s2.addFields(78, 13, 66, 3);

assertEquals(0, s1.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ protected Class<Boolean> getTypeClass() {
protected Boolean[] getTestData() {
Random rnd = new Random(874597969123412341L);

return new Boolean[] {new Boolean(true), new Boolean(false),
new Boolean(rnd.nextBoolean()),
new Boolean(rnd.nextBoolean()),
new Boolean(rnd.nextBoolean())};
return new Boolean[] {Boolean.valueOf(true), Boolean.valueOf(false),
Boolean.valueOf(rnd.nextBoolean()),
Boolean.valueOf(rnd.nextBoolean()),
Boolean.valueOf(rnd.nextBoolean())};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ protected Byte[] getSortedTestData() {
rndByte += 3;
}
return new Byte[]{
new Byte(Byte.MIN_VALUE),
new Byte(new Integer(-rndByte).byteValue()),
new Byte(new Integer(-1).byteValue()),
new Byte(new Integer(0).byteValue()),
new Byte(new Integer(1).byteValue()),
new Byte(new Integer(2).byteValue()),
new Byte(new Integer(rndByte).byteValue()),
new Byte(Byte.MAX_VALUE)};
Byte.valueOf(Byte.MIN_VALUE),
Byte.valueOf(Integer.valueOf(-rndByte).byteValue()),
Byte.valueOf(Integer.valueOf(-1).byteValue()),
Byte.valueOf(Integer.valueOf(0).byteValue()),
Byte.valueOf(Integer.valueOf(1).byteValue()),
Byte.valueOf(Integer.valueOf(2).byteValue()),
Byte.valueOf(Integer.valueOf(rndByte).byteValue()),
Byte.valueOf(Byte.MAX_VALUE)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ protected Byte[] getTestData() {
byte byteArray[] = new byte[1];
rnd.nextBytes(byteArray);

return new Byte[] {new Byte((byte) 0), new Byte((byte) 1), new Byte((byte) -1),
return new Byte[] {Byte.valueOf((byte) 0), Byte.valueOf((byte) 1), Byte.valueOf((byte) -1),
Byte.MAX_VALUE, Byte.MIN_VALUE,
new Byte(byteArray[0]), new Byte((byte) -byteArray[0])};
Byte.valueOf(byteArray[0]), Byte.valueOf((byte) -byteArray[0])};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ protected Double[] getSortedTestData() {
rndDouble += 3;
}
return new Double[]{
new Double(-rndDouble),
new Double(-1.0D),
new Double(0.0D),
new Double(2.0D),
new Double(rndDouble),
new Double(Double.MAX_VALUE)};
Double.valueOf(-rndDouble),
Double.valueOf(-1.0D),
Double.valueOf(0.0D),
Double.valueOf(2.0D),
Double.valueOf(rndDouble),
Double.valueOf(Double.MAX_VALUE)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ protected Double[] getTestData() {
Random rnd = new Random(874597969123412341L);
Double rndDouble = rnd.nextDouble() * Double.MAX_VALUE;

return new Double[] {new Double(0), new Double(1), new Double(-1),
new Double(Double.MAX_VALUE), new Double(Double.MIN_VALUE),
new Double(rndDouble), new Double(-rndDouble),
new Double(Double.NaN),
new Double(Double.NEGATIVE_INFINITY), new Double(Double.POSITIVE_INFINITY)};
return new Double[] {Double.valueOf(0), Double.valueOf(1), Double.valueOf(-1),
Double.valueOf(Double.MAX_VALUE), Double.valueOf(Double.MIN_VALUE),
Double.valueOf(rndDouble), Double.valueOf(-rndDouble),
Double.valueOf(Double.NaN),
Double.valueOf(Double.NEGATIVE_INFINITY), Double.valueOf(Double.POSITIVE_INFINITY)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ protected Float[] getSortedTestData() {
rndFloat += 3;
}
return new Float[]{
new Float(-rndFloat),
new Float(-1.0F),
new Float(0.0F),
new Float(2.0F),
new Float(rndFloat),
new Float(Float.MAX_VALUE)};
Float.valueOf(-rndFloat),
Float.valueOf(-1.0F),
Float.valueOf(0.0F),
Float.valueOf(2.0F),
Float.valueOf(rndFloat),
Float.valueOf(Float.MAX_VALUE)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ protected Float[] getTestData() {
Random rnd = new Random(874597969123412341L);
float rndFloat = rnd.nextFloat() * Float.MAX_VALUE;

return new Float[] {new Float(0), new Float(1), new Float(-1),
new Float(Float.MAX_VALUE), new Float(Float.MIN_VALUE),
new Float(rndFloat), new Float(-rndFloat),
new Float(Float.NaN),
new Float(Float.NEGATIVE_INFINITY), new Float(Float.POSITIVE_INFINITY)};
return new Float[] {Float.valueOf(0), Float.valueOf(1), Float.valueOf(-1),
Float.valueOf(Float.MAX_VALUE), Float.valueOf(Float.MIN_VALUE),
Float.valueOf(rndFloat), Float.valueOf(-rndFloat),
Float.valueOf(Float.NaN),
Float.valueOf(Float.NEGATIVE_INFINITY), Float.valueOf(Float.POSITIVE_INFINITY)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ protected Integer[] getSortedTestData() {
rndInt += 3;
}
return new Integer[]{
new Integer(Integer.MIN_VALUE),
new Integer(-rndInt),
new Integer(-1),
new Integer(0),
new Integer(1),
new Integer(2),
new Integer(rndInt),
new Integer(Integer.MAX_VALUE)};
Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(-rndInt),
Integer.valueOf(-1),
Integer.valueOf(0),
Integer.valueOf(1),
Integer.valueOf(2),
Integer.valueOf(rndInt),
Integer.valueOf(Integer.MAX_VALUE)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ protected Integer[] getTestData() {
Random rnd = new Random(874597969123412341L);
int rndInt = rnd.nextInt();

return new Integer[] {new Integer(0), new Integer(1), new Integer(-1),
new Integer(Integer.MAX_VALUE), new Integer(Integer.MIN_VALUE),
new Integer(rndInt), new Integer(-rndInt)};
return new Integer[] {Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(-1),
Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(rndInt), Integer.valueOf(-rndInt)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ protected Long[] getSortedTestData() {
rndLong += 3;
}
return new Long[]{
new Long(Long.MIN_VALUE),
new Long(-rndLong),
new Long(-1L),
new Long(0L),
new Long(1L),
new Long(2L),
new Long(rndLong),
new Long(Long.MAX_VALUE)};
Long.valueOf(Long.MIN_VALUE),
Long.valueOf(-rndLong),
Long.valueOf(-1L),
Long.valueOf(0L),
Long.valueOf(1L),
Long.valueOf(2L),
Long.valueOf(rndLong),
Long.valueOf(Long.MAX_VALUE)};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ protected Long[] getTestData() {
Random rnd = new Random(874597969123412341L);
long rndLong = rnd.nextLong();

return new Long[] {new Long(0L), new Long(1L), new Long(-1L),
new Long(Long.MAX_VALUE), new Long(Long.MIN_VALUE),
new Long(rndLong), new Long(-rndLong)};
return new Long[] {Long.valueOf(0L), Long.valueOf(1L), Long.valueOf(-1L),
Long.valueOf(Long.MAX_VALUE), Long.valueOf(Long.MIN_VALUE),
Long.valueOf(rndLong), Long.valueOf(-rndLong)};
}
}
Loading

0 comments on commit c339c26

Please sign in to comment.