title: Inner list from DTO is null while testing with Spring WebFlux
body: <p>I have the following unit test (JUnit 5):</p>
  
  <pre><code>FluxExchangeResult&lt;CalendarDTO&gt; calendarEntityResult = client.get()
                  .exchange()
                  .expectStatus().isOk()
                  .expectHeader().contentType(MediaType.APPLICATION_JSON_UTF8)
                  .returnResult(CalendarDTO.class);
  
          assertNotNull(calendarEntityResult);
          final Flux&lt;CalendarDTO&gt; responseBody = calendarEntityResult.getResponseBody();
          responseBody.flatMap(calendarDTO -&gt; {
              assertNotNull(calendarDTO);
              final List&lt;AppointmentDTO&gt; calendarEvents = calendarDTO.getCalendarEvents();
              assertNotNull(calendarEvents);
              assertFalse(calendarEvents.isEmpty());
  
              return Flux.just(calendarEvents);
          }).map(calendarEvents -&gt;
              calendarEvents.get(0)
          ).doOnNext(appointmentDTO -&gt;
              assertEquals(appointmentDTO, validAppointmentDTO())
          ).subscribe();
          /*StepVerifier.create(responseBody)
              .assertNext(calendarDTO -&gt; {
                  assertNotNull(calendarDTO);
                  final List&lt;AppointmentDTO&gt; calendarEvents = calendarDTO.getCalendarEvents();
                  assertNotNull(calendarEvents);
                  assertFalse(calendarEvents.isEmpty());
  
                  final AppointmentDTO appointmentDTO = calendarEvents.get(0);
                  assertNotNull(appointmentDTO);
                  assertEquals(validAppointmentDTO(), appointmentDTO);
              })
          .expectComplete()
          .verify();*/
  </code></pre>
  
  <p>For some reason, the <code>assertNotNull(calendarEvents);</code> is failing. The method itself when running it with Postman is fine. What has me puzzled is that on debug time, the <code>calendarEntityResult</code> has <code>calendarEvents</code>!</p>
  
  <pre><code>&gt; GET /appointments
  &gt; WebTestClient-Request-Id: [1]
  
  No content
  
  &lt; 200 OK OK
  &lt; Content-Type: [application/json;charset=UTF-8]
  &lt; Content-Length: [377]
  
  {"data":{"calendarEvents":[{"id":null,"startTime":"2020-01-16T13:19:37.510-06:00","endTime":"2020-01-16T14:19:37.511-06:00","timeZoneStart":"America/Regina","timeZoneEnd":"America/Regina","summary":"unit test summary","description":"unit test description","organizerName":"Developer","organizerEmail":"developer@dev.com","status":null,"alarm":15}]},"notifications":null}
  </code></pre>
  
  <p>The commented code gives the same result. To be clear, the DTO itself is not null; the problem is the calendarEvents array. It's possible I'm doing something wrong since I'm new to reactive programming in general, so code improvements are most welcome. Am I extracting the data in a wrong manner?</p>