コード例 #1
0
  @Test
  public void validateSingleness_personAlreadyRegistered() {
    when(repository.findByContactEmail(PERSONS_EMAIL)).thenReturn(Optional.of(person));

    exception.expect(PersonAlreadyRegisteredException.class);

    subject.execute(person);
  }
コード例 #2
0
 private void configureRepository() {
   when(repository.findByContactEmail(PERSONS_EMAIL)).thenReturn(Optional.ofNullable(null));
 }