Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-1907

Error in method findOne(Example example) in ReactiveQueryByExampleExecutor when there is no results

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1 M1 (Lovelace), 2.0.5 (Kay SR5)
    • Component/s: None
    • Labels:
      None

      Description

      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()));
      

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            rubenjgarciab Ruben Garcia
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: