Even my code is correct and test cases success i am failed in test

In spite my java code is correct . It shows failed in test. My all test cases shown sucess.

my line is
moviesCollection.find(castFilter).sort(sort).limit(limit).skip(skip).iterator().forEachRemaining(movies::add);

answer

moviesCollection
.find(castFilter)
.sort(sort)
.limit(limit)
.skip(skip)
.iterator()
.forEachRemaining(movies::add);
return movies;

So you call all the same methods in the same order with the parameter name. But it is the value of the parameter that is important. One of the value must be different.

In all likelihood your problem is here
.find(castFilter)

I would bet that castFilter is not calling the correct method.
I would bet you are getting a failure on testSearchMultipleCast (run this test to see)

If so then you are using the wrong implementation for .find(castFilter).

That’s the point of the comment in the hint
Hint

Check the implementation of similar formats of search criteria - the cast query should similar.

Following is my implementation

public List getMoviesByCast(String sortKey, int limit, int skip, String… cast) {

Bson castFilter = Filters.in(“cast”, cast);

Bson sort = Sorts.ascending(sortKey);

List movies = new ArrayList<>();

moviesCollection.find(castFilter).sort(sort).limit(limit).skip(skip).iterator().forEachRemaining(movies::add);

return movies;

}

Rajesh A Parab | Sr. Technical Specialist

CISCO

Zensar Technologies,
Zensar Campus Kharadi ,Fuji, 3rd Floor,
Tel: ----- M: +91-9890991542
E: r.parab@zensar.com www.zensar.com

Disclaimer: The contents of this e-mail and attachment(s) thereto are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or Zensar Technologies Limited or its affiliates. Any views or opinions presented
in this email are solely those of the author and may not necessarily reflect the opinions of Zensar Technologies Limited or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this
message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any mail and attachments please check them for viruses
and defect. Zensar Technologies Ltd or its affiliate do not accept any liability for virus infected mails.

In the requirements, it is stated to look at getMoviesByGenres and getMoviesByText for examples. In getMoviesByGenres we also receive a sortKey as in getMoviesByCast. In …ByGenres they sort descending but in your code you sort ascending. I think that’s what is wrong with your code. The fact that you pass the test cases tells me that some conditions are not testes.