Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ private Object newNode(int element) {

if (constructor.getParameters().length == 1) {
return constructor.newInstance(element);
} else if (constructor.getParameters().length == 2) {
return constructor.newInstance(element, null);
} else {
Object node = constructor.newInstance();
getNodeElementField(node).set(node, element);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,19 @@ void pollMakesSizeZeroWhenQueueHasSingleElement() {
}

@Test
@SneakyThrows
@Order(11)
void pollMakesQueueEmptyWhenQueueHasSingleElement() {
addIntElementToQueue(1);
this.integerQueue.poll();
boolean isEmpty = isEmptyQueue();

Object tail = getAccessibleFieldByPredicate(integerQueue, TAIL_FIELD).get(integerQueue);
Object head = getAccessibleFieldByPredicate(integerQueue, HEAD_FIELD).get(integerQueue);

assertThat(isEmpty).isEqualTo(true);
assertThat(tail).isNull();
assertThat(head).isNull();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.junit.jupiter.params.provider.Arguments.arguments;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
class BinarySearchTreeTest {
class RecursiveBinarySearchTreeTest {

private static final Predicate<Field> SIZE_FIELD = field -> field.getName().toLowerCase().contains("size")
|| field.getName().toLowerCase().contains("length");
Expand Down