Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in method findOne(Example example) in ReactiveQueryByExampleExecutor when there is no results [DATAMONGO-1907] #2808

Closed
spring-projects-issues opened this issue Mar 20, 2018 · 0 comments
Assignees

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Mar 20, 2018

Ruben Garcia opened DATAMONGO-1907 and commented

I have this test code that is ok in class SimpleReactiveMongoRepositoryTests

Example<ReactivePerson> example = Example.of(new ReactivePerson("foo", "bar", -1));
StepVerifier.create(repository.findById("foo")).expectNextCount(0).verifyComplete();

But if I write this

Example<ReactivePerson> example = Example.of(new ReactivePerson("foo", "bar", -1));
StepVerifier.create(repository.findOne(example)).expectNextCount(0).verifyComplete();

An exception is thrown

java.lang.AssertionError: expectation "expectComplete" failed (expected: onComplete(); actual: onError(java.util.NoSuchElementException: Source was empty))

I think the behaviour should be the same because I can't write this code because an Exception is thrown

myRepository.findOne(Example.of(anExample))
  .switchIfEmpty(Mono.error(new DocumentNotFoundException()));

Affects: 2.1 M1 (Lovelace), 2.0.5 (Kay SR5)

Referenced from: pull request #541

Backported to: 2.0.6 (Kay SR6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants