@Test
  public void shouldFindOneById() {
    OutsiderTeacher model = OutsiderTeacherTest.createOne();
    scenarioHelper.createOutsiderTeacher(model);

    OutsiderTeacher fetched = outsiderTeacherManager.findOneById(model.getId());
    assertThat(fetched).isNotNull();
  }
  @Test
  public void shouldDeleteAddressAndEmailAndPhoneOnCascade() {
    OutsiderTeacher model = OutsiderTeacherTest.createOne();
    scenarioHelper.createOutsiderTeacher(model);
    outsiderTeacherRepository.delete(new OutsiderTeacherDomain(model));

    assertThat(addressRepository.findAll()).isEmpty();
    assertThat(emailRepository.findAll()).isEmpty();
    assertThat(phoneRepository.findAll()).isEmpty();
  }
  @Test
  public void shouldCreate() {
    OutsiderTeacher model = OutsiderTeacherTest.createOneEmpty();
    OutsiderTeacher saved = outsiderTeacherManager.create(model);
    OutsiderTeacher fetched = outsiderTeacherManager.findOneById(model.getId());

    assertThat(model.getId()).isNotNull();
    assertThat(saved.getId()).isNotNull();
    assertThat(fetched.getName()).isEqualTo(model.getName());
    assertThat(fetched.getContact()).isEqualTo(model.getContact());
  }
  @Test
  public void shouldCreateAddressAndEmailAndPhoneOnCascade() {
    OutsiderTeacher model = OutsiderTeacherTest.createOne();
    scenarioHelper.createOutsiderTeacher(model);
    OutsiderTeacher fetched = outsiderTeacherManager.findOneById(model.getId());

    assertThat(addressRepository.findAll()).hasSameSizeAs(model.getContact().getAddresses());
    assertThat(emailRepository.findAll()).hasSameSizeAs(model.getContact().getEmails());
    assertThat(phoneRepository.findAll()).hasSameSizeAs(model.getContact().getPhones());
    assertThat(fetched.getContact().getAddresses())
        .hasSameSizeAs(model.getContact().getAddresses());
    assertThat(fetched.getContact().getEmails()).hasSameSizeAs(model.getContact().getEmails());
    assertThat(fetched.getContact().getPhones()).hasSameSizeAs(model.getContact().getPhones());
  }
 @Test(expected = AlreadyDefinedInOnNonPersistedEntity.class)
 public void shouldFailCreateIfIdIsAlreadyDefined() {
   OutsiderTeacher model = OutsiderTeacherTest.createOne();
   model.setId(12L);
   outsiderTeacherManager.create(model);
 }