@Test public void shouldSaveNewStudentWithoutWritingToDb() throws Exception { studentRepository.registerNew(student1); studentRepository.registerNew(student2); assertEquals(2, context.get(IUnitOfWork.INSERT).size()); verifyNoMoreInteractions(studentDatabase); }
@Override public void registerNew(Student student) { LOGGER.info("Registering {} for insert in context.", student.getName()); register(student, IUnitOfWork.INSERT); }
StudentRepository implements IUnitOfWork<Student> { @Override public void registerNew(Student student) { LOGGER.info("Registering {} for insert in context.", student.getName()); register(student, IUnitOfWork.INSERT); } }
StudentRepository implements IUnitOfWork<Student> { @Override public void registerNew(Student student) { LOGGER.info("Registering {} for insert in context.", student.getName()); register(student, IUnitOfWork.INSERT); } StudentRepository(Map<String, List<Student>> context, StudentDatabase studentDatabase); }
StudentRepository implements IUnitOfWork<Student> { @Override public void registerNew(Student student) { LOGGER.info("Registering {} for insert in context.", student.getName()); register(student, IUnitOfWork.INSERT); } StudentRepository(Map<String, List<Student>> context, StudentDatabase studentDatabase); @Override void registerNew(Student student); @Override void registerModified(Student student); @Override void registerDeleted(Student student); @Override void commit(); }
StudentRepository implements IUnitOfWork<Student> { @Override public void registerNew(Student student) { LOGGER.info("Registering {} for insert in context.", student.getName()); register(student, IUnitOfWork.INSERT); } StudentRepository(Map<String, List<Student>> context, StudentDatabase studentDatabase); @Override void registerNew(Student student); @Override void registerModified(Student student); @Override void registerDeleted(Student student); @Override void commit();  }