@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(expected = AlreadyDefinedInOnNonPersistedEntity.class) public void shouldFailCreateIfIdIsAlreadyDefined() { OutsiderTeacher model = OutsiderTeacherTest.createOne(); model.setId(12L); outsiderTeacherManager.create(model); }
@Test(expected = IllegalArgumentException.class) public void shouldFailCreateWithNull() { outsiderTeacherManager.create(null); }