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) {
353353
354354 if (constructor .getParameters ().length == 1 ) {
355355 return constructor .newInstance (element );
356+ } else if (constructor .getParameters ().length == 2 ) {
357+ return constructor .newInstance (element , null );
356358 } else {
357359 Object node = constructor .newInstance ();
358360 getNodeElementField (node ).set (node , element );
Original file line number Diff line number Diff line change @@ -164,13 +164,19 @@ void pollMakesSizeZeroWhenQueueHasSingleElement() {
164164 }
165165
166166 @ Test
167+ @ SneakyThrows
167168 @ Order (11 )
168169 void pollMakesQueueEmptyWhenQueueHasSingleElement () {
169170 addIntElementToQueue (1 );
170171 this .integerQueue .poll ();
171172 boolean isEmpty = isEmptyQueue ();
172173
174+ Object tail = getAccessibleFieldByPredicate (integerQueue , TAIL_FIELD ).get (integerQueue );
175+ Object head = getAccessibleFieldByPredicate (integerQueue , HEAD_FIELD ).get (integerQueue );
176+
173177 assertThat (isEmpty ).isEqualTo (true );
178+ assertThat (tail ).isNull ();
179+ assertThat (head ).isNull ();
174180 }
175181
176182 @ Test
Original file line number Diff line number Diff line change 2121import static org .junit .jupiter .params .provider .Arguments .arguments ;
2222
2323@ TestMethodOrder (MethodOrderer .OrderAnnotation .class )
24- class BinarySearchTreeTest {
24+ class RecursiveBinarySearchTreeTest {
2525
2626 private static final Predicate <Field > SIZE_FIELD = field -> field .getName ().toLowerCase ().contains ("size" )
2727 || field .getName ().toLowerCase ().contains ("length" );
You can’t perform that action at this time.
0 commit comments