Skip to content

Commit

Permalink
update org.junit.Assert to org.junit.jupiter.api.Assertions.assertXXX
Browse files Browse the repository at this point in the history
  • Loading branch information
llama90 committed Jun 6, 2024
1 parent ad897bb commit 5cd073b
Show file tree
Hide file tree
Showing 68 changed files with 757 additions and 699 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.arrow.vector;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

package org.apache.arrow.vector;

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 static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.stream.IntStream;

Expand All @@ -30,7 +30,6 @@
import org.apache.arrow.vector.testing.ValueVectorDataPopulator;
import org.apache.arrow.vector.util.TransferPair;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -124,8 +123,9 @@ public void testSplitAndTransfer() throws Exception {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i, expected, actual);
assertEquals(expected, actual,
"different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i);
}
}
}
Expand Down Expand Up @@ -167,8 +167,9 @@ public void testSplitAndTransfer1() throws Exception {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i, expected, actual);
assertEquals(expected, actual,
"different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i);
}
}
}
Expand Down Expand Up @@ -218,8 +219,9 @@ public void testSplitAndTransfer2() throws Exception {
for (int i = 0; i < length; i++) {
int actual = toVector.get(i);
int expected = sourceVector.get(start + i);
assertEquals("different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i, expected, actual);
assertEquals(expected, actual,
"different data values not expected --> sourceVector index: " + (start + i) +
" toVector index: " + i);
}
}
}
Expand All @@ -241,9 +243,9 @@ public void testReallocAfterVectorTransfer1() {

for (int i = 0; i < valueCapacity; i++) {
if ((i & 1) == 1) {
assertEquals("unexpected cleared bit at index: " + i, 1, vector.get(i));
assertEquals(1, vector.get(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -259,9 +261,9 @@ public void testReallocAfterVectorTransfer1() {

for (int i = 0; i < valueCapacity * 2; i++) {
if (((i & 1) == 1) || (i == valueCapacity)) {
assertEquals("unexpected cleared bit at index: " + i, 1, vector.get(i));
assertEquals(1, vector.get(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -277,9 +279,9 @@ public void testReallocAfterVectorTransfer1() {

for (int i = 0; i < valueCapacity * 4; i++) {
if (((i & 1) == 1) || (i == valueCapacity) || (i == valueCapacity * 2)) {
assertEquals("unexpected cleared bit at index: " + i, 1, vector.get(i));
assertEquals(1, vector.get(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -297,12 +299,12 @@ public void testReallocAfterVectorTransfer1() {
if (i <= valueCapacity * 4) {
if (((i & 1) == 1) || (i == valueCapacity) ||
(i == valueCapacity * 2) || (i == valueCapacity * 4)) {
assertEquals("unexpected cleared bit at index: " + i, 1, toVector.get(i));
assertEquals(1, toVector.get(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, toVector.isNull(i));
assertTrue(toVector.isNull(i), "unexpected set bit at index: " + i);
}
} else {
assertTrue("unexpected set bit at index: " + i, toVector.isNull(i));
assertTrue(toVector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -325,9 +327,9 @@ public void testReallocAfterVectorTransfer2() {

for (int i = 0; i < valueCapacity; i++) {
if ((i & 1) == 1) {
assertFalse("unexpected cleared bit at index: " + i, vector.isNull(i));
assertFalse(vector.isNull(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -343,9 +345,9 @@ public void testReallocAfterVectorTransfer2() {

for (int i = 0; i < valueCapacity * 2; i++) {
if (((i & 1) == 1) || (i == valueCapacity)) {
assertFalse("unexpected cleared bit at index: " + i, vector.isNull(i));
assertFalse(vector.isNull(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -361,9 +363,9 @@ public void testReallocAfterVectorTransfer2() {

for (int i = 0; i < valueCapacity * 4; i++) {
if (((i & 1) == 1) || (i == valueCapacity) || (i == valueCapacity * 2)) {
assertFalse("unexpected cleared bit at index: " + i, vector.isNull(i));
assertFalse(vector.isNull(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, vector.isNull(i));
assertTrue(vector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand All @@ -381,12 +383,12 @@ public void testReallocAfterVectorTransfer2() {
if (i <= valueCapacity * 4) {
if (((i & 1) == 1) || (i == valueCapacity) ||
(i == valueCapacity * 2) || (i == valueCapacity * 4)) {
assertFalse("unexpected cleared bit at index: " + i, toVector.isNull(i));
assertFalse(toVector.isNull(i), "unexpected cleared bit at index: " + i);
} else {
assertTrue("unexpected set bit at index: " + i, toVector.isNull(i));
assertTrue(toVector.isNull(i), "unexpected set bit at index: " + i);
}
} else {
assertTrue("unexpected set bit at index: " + i, toVector.isNull(i));
assertTrue(toVector.isNull(i), "unexpected set bit at index: " + i);
}
}

Expand Down Expand Up @@ -500,13 +502,13 @@ private void validateRange(int length, int start, int count) {
bitVector.allocateNew(length);
bitVector.setRangeToOne(start, count);
for (int i = 0; i < start; i++) {
Assert.assertTrue(desc + i, bitVector.isNull(i));
assertTrue(bitVector.isNull(i), desc + i);
}
for (int i = start; i < start + count; i++) {
Assert.assertEquals(desc + i, 1, bitVector.get(i));
assertEquals(1, bitVector.get(i), desc + i);
}
for (int i = start + count; i < length; i++) {
Assert.assertTrue(desc + i, bitVector.isNull(i));
assertTrue(bitVector.isNull(i), desc + i);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.arrow.vector;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.apache.arrow.memory.ArrowBuf;
import org.apache.arrow.memory.BufferAllocator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

package org.apache.arrow.vector;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.nio.charset.StandardCharsets;

Expand Down
Loading

0 comments on commit 5cd073b

Please sign in to comment.