mirror of https://github.com/apache/druid.git
remove commons-lang3 usage from DoubleMeanAggregatorFactoryTest (#9578)
This commit is contained in:
parent
fa5da6693c
commit
839379246a
|
@ -27,6 +27,7 @@ import com.google.common.primitives.Doubles;
|
|||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DoubleMeanHolder
|
||||
{
|
||||
|
@ -68,6 +69,26 @@ public class DoubleMeanHolder
|
|||
return buf.array();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DoubleMeanHolder that = (DoubleMeanHolder) o;
|
||||
return Double.compare(that.sum, sum) == 0 &&
|
||||
count == that.count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(sum, count);
|
||||
}
|
||||
|
||||
public static DoubleMeanHolder fromBytes(byte[] data)
|
||||
{
|
||||
ByteBuffer buf = ByteBuffer.wrap(data);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.apache.druid.query.aggregation.mean;
|
||||
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,10 +39,10 @@ public class DoubleMeanAggregatorFactoryTest
|
|||
DoubleMeanHolder expectedHolder = new DoubleMeanHolder(50.0, 10L);
|
||||
|
||||
DoubleMeanHolder actualHolder = (DoubleMeanHolder) factory.deserialize(expectedHolder);
|
||||
Assert.assertTrue(EqualsBuilder.reflectionEquals(expectedHolder, actualHolder));
|
||||
Assert.assertEquals(expectedHolder, actualHolder);
|
||||
|
||||
actualHolder = (DoubleMeanHolder) factory.deserialize(expectedHolder.toBytes());
|
||||
Assert.assertTrue(EqualsBuilder.reflectionEquals(expectedHolder, actualHolder));
|
||||
Assert.assertEquals(expectedHolder, actualHolder);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue