aboutsummaryrefslogtreecommitdiffstats
path: root/predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java')
-rw-r--r--predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java25
1 files changed, 11 insertions, 14 deletions
diff --git a/predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java b/predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java
index eb641b6fa05..692fb9ab696 100644
--- a/predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java
+++ b/predicate-search/src/test/java/com/yahoo/search/predicate/utils/PrimitiveArraySorterTest.java
@@ -1,33 +1,30 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.predicate.utils;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Random;
-import static org.junit.Assert.assertArrayEquals;
-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.*;
public class PrimitiveArraySorterTest {
@Test
- public void sorting_empty_array_should_not_throw_exception() {
+ void sorting_empty_array_should_not_throw_exception() {
short[] array = {};
PrimitiveArraySorter.sort(array, Short::compare);
}
@Test
- public void test_sorting_single_item_array() {
+ void test_sorting_single_item_array() {
short[] array = {42};
PrimitiveArraySorter.sort(array, Short::compare);
assertEquals(42, array[0]);
}
@Test
- public void test_sorting_custom_comparator() {
+ void test_sorting_custom_comparator() {
short[] array = {4, 2, 5};
PrimitiveArraySorter.sort(array, (a, b) -> Short.compare(b, a)); // Sort using inverse ordering.
short[] expected = {5, 4, 2};
@@ -35,7 +32,7 @@ public class PrimitiveArraySorterTest {
}
@Test
- public void test_complicated_array() {
+ void test_complicated_array() {
short[] array = {20381, -28785, -19398, 17307, -12612, 11459, -30164, -16597, -4267, 30838, 8918, 9014, -26444,
-1232, -14620, 12636, -12389, -4931, 32108, 19854, -12681, 14933, 319, 27348, -4907, 19196, 14209,
-32694, 2579, 9771, -1157, -13717, 28506, -8016, 21423, 23697, 23755, 29650, 25644, -14660, -18952,
@@ -48,7 +45,7 @@ public class PrimitiveArraySorterTest {
}
@Test
- public void sorting_random_arrays_should_produce_identical_result_as_java_sort() {
+ void sorting_random_arrays_should_produce_identical_result_as_java_sort() {
Random r = new Random(4234);
for (int i = 0; i < 10000; i++) {
short[] original = makeRandomArray(r);
@@ -57,12 +54,12 @@ public class PrimitiveArraySorterTest {
PrimitiveArraySorter.sort(customSorted, Short::compare);
Arrays.sort(javaSorted);
String errorMsg = String.format("%s != %s (before sorting: %s)", Arrays.toString(customSorted), Arrays.toString(javaSorted), Arrays.toString(original));
- assertArrayEquals(errorMsg, customSorted, javaSorted);
+ assertArrayEquals(customSorted, javaSorted, errorMsg);
}
}
@Test
- public void test_merging_simple_array() {
+ void test_merging_simple_array() {
short[] array = {-20, -12, 2, -22, -11, 33, 44};
short[] expected = {-22, -20, -12, -11, 2, 33, 44};
short[] result = new short[array.length];
@@ -71,7 +68,7 @@ public class PrimitiveArraySorterTest {
}
@Test
- public void test_merging_of_random_generated_arrays() {
+ void test_merging_of_random_generated_arrays() {
Random r = new Random(4234);
for (int i = 0; i < 10000; i++) {
short[] array = makeRandomArray(r);
@@ -89,7 +86,7 @@ public class PrimitiveArraySorterTest {
}
@Test
- public void test_sortandmerge_returns_false_when_sort_is_in_place() {
+ void test_sortandmerge_returns_false_when_sort_is_in_place() {
short[] array = {3, 2, 1, 0, 4, 5, 6};
short[] mergeArray = new short[array.length];
assertFalse(PrimitiveArraySorter.sortAndMerge(array, mergeArray, 4, 7, Short::compare));