teacher = new Teacher("newUser", "newPassword", new Integer("2"));  try { persistentSupport.iniciarTransaccao(); persistentTeacher.lockWrite(teacher); persistentSupport.confirmarTransaccao(); } catch(ExcepcaoPersistencia excepcaoPersistencia) { fail("testLockWrite: write non Existing"); }  ITeacher teacherRead = null;  try { persistentSupport.iniciarTransaccao(); teacherRead = persistentTeacher.readTeacherByNumber(teacher.getTeacherNumber()); persistentSupport.confirmarTransaccao(); } catch(ExcepcaoPersistencia excepcaoPersistencia) { fail("testEscreverPais: unexpected exception reading"); } assertNotNull(teacherRead); assertEquals(teacherRead.getTeacherNumber(), teacher.getTeacherNumber()); assertEquals(teacherRead.getResponsableForExecutionCourses(), teacher.getResponsableForExecutionCourses()); assertEquals(teacherRead.getProfessorShipsExecutionCourses(), teacher.getProfessorShipsExecutionCourses());  }
IPessoa person = new Pessoa(new TipoDocumentoIdentificacao( TipoDocumentoIdentificacao.BILHETE_DE_IDENTIDADE),"eusoufixe");  teacher = new Teacher(person, new Integer("2"));  try { persistentSupport.iniciarTransaccao(); persistentTeacher.lockWrite(teacher); persistentSupport.confirmarTransaccao(); } catch (ExcepcaoPersistencia excepcaoPersistencia) { fail("testLockWrite: write non Existing"); }  ITeacher teacherRead = null;  try { persistentSupport.iniciarTransaccao(); teacherRead = persistentTeacher.readTeacherByNumber( teacher.getTeacherNumber()); persistentSupport.confirmarTransaccao(); } catch (ExcepcaoPersistencia excepcaoPersistencia) { fail("testEscreverPais: unexpected exception reading"); } assertNotNull(teacherRead); assertEquals( teacherRead.getTeacherNumber(), teacher.getTeacherNumber()); assertEquals( teacherRead.getResponsibleForExecutionCourses(), teacher.getResponsibleForExecutionCourses()); assertEquals( teacherRead.getProfessorShipsExecutionCourses(), teacher.getProfessorShipsExecutionCourses());  }
    public void testLockWrite() {		ITeacher teacher = null;        // write non existing        teacher = new Teacher("newUser", "newPassword", new Integer("2"));                try {            persistentSupport.iniciarTransaccao();            persistentTeacher.lockWrite(teacher);            persistentSupport.confirmarTransaccao();        } catch(ExcepcaoPersistencia excepcaoPersistencia) {		    fail("testLockWrite: write non Existing");	        }                ITeacher teacherRead = null;                try {            persistentSupport.iniciarTransaccao();            teacherRead = persistentTeacher.readTeacherByNumber(teacher.getTeacherNumber());            persistentSupport.confirmarTransaccao();        } catch(ExcepcaoPersistencia excepcaoPersistencia) {            fail("testEscreverPais: unexpected exception reading");        }        assertNotNull(teacherRead);        assertEquals(teacherRead.getTeacherNumber(), teacher.getTeacherNumber());        assertEquals(teacherRead.getResponsableForExecutionCourses(), teacher.getResponsableForExecutionCourses());        assertEquals(teacherRead.getProfessorShipsExecutionCourses(), teacher.getProfessorShipsExecutionCourses());            }