File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
2-0-data-structures-and-algorithms
2-2-2-stack/src/test/java/com/bobocode/cs
2-2-3-linked-queue/src/test/java/com/bobocode/cs
2-2-6-binary-search-tree/src/test/java/com/bobocode/cs Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,8 @@ private Object newNode(int element) {
353
353
354
354
if (constructor .getParameters ().length == 1 ) {
355
355
return constructor .newInstance (element );
356
+ } else if (constructor .getParameters ().length == 2 ) {
357
+ return constructor .newInstance (element , null );
356
358
} else {
357
359
Object node = constructor .newInstance ();
358
360
getNodeElementField (node ).set (node , element );
Original file line number Diff line number Diff line change @@ -164,13 +164,19 @@ void pollMakesSizeZeroWhenQueueHasSingleElement() {
164
164
}
165
165
166
166
@ Test
167
+ @ SneakyThrows
167
168
@ Order (11 )
168
169
void pollMakesQueueEmptyWhenQueueHasSingleElement () {
169
170
addIntElementToQueue (1 );
170
171
this .integerQueue .poll ();
171
172
boolean isEmpty = isEmptyQueue ();
172
173
174
+ Object tail = getAccessibleFieldByPredicate (integerQueue , TAIL_FIELD ).get (integerQueue );
175
+ Object head = getAccessibleFieldByPredicate (integerQueue , HEAD_FIELD ).get (integerQueue );
176
+
173
177
assertThat (isEmpty ).isEqualTo (true );
178
+ assertThat (tail ).isNull ();
179
+ assertThat (head ).isNull ();
174
180
}
175
181
176
182
@ Test
Original file line number Diff line number Diff line change 21
21
import static org .junit .jupiter .params .provider .Arguments .arguments ;
22
22
23
23
@ TestMethodOrder (MethodOrderer .OrderAnnotation .class )
24
- class BinarySearchTreeTest {
24
+ class RecursiveBinarySearchTreeTest {
25
25
26
26
private static final Predicate <Field > SIZE_FIELD = field -> field .getName ().toLowerCase ().contains ("size" )
27
27
|| field .getName ().toLowerCase ().contains ("length" );
You can’t perform that action at this time.
0 commit comments