source: class SampleServiceImplTest {
  
      @Test
      public void shouldReturnTrueWhenCreatePersonIsNonOk() throws Exception {
  
target:         PersonService personService = mock(PersonService.class);
          EventService eventService = mock(EventService.class);
          BusinessMessages businessMessages = mock(BusinessMessages.class);
  
          whenNew(BusinessMessages.class).withNoArguments().thenReturn(businessMessages);
          when(businessMessages.hasErrors()).thenReturn(true);
          InOrder inOrder = inOrder(personService, eventService);
  
          SampleServiceImpl sampleService = new SampleServiceImpl(personService, eventService);
  
          boolean isCreated = sampleService.createPerson("Maxime", "Nowak");
  
          assertThat(isCreated).isFalse();
  
          inOrder.verify(personService, times(1)).create(any(Person.class), any(BusinessMessages.class));
          inOrder.verify(eventService, times(1)).sendErrorEvent(any(Person.class), eq(businessMessages));
      }
  
  }