### Question:
StudentModel { public void deleteUser(String username) { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; try { documentBuilder = documentBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } Document document = null; try { assert documentBuilder != null; document = documentBuilder.parse(filePath); } catch (SAXException | IOException e) { e.printStackTrace(); } assert document != null; Element root = document.getDocumentElement(); NodeList students = root.getElementsByTagName("student"); Node student = null; for (int i = 0; i < students.getLength(); i++) { student = students.item(i); if (student.getAttributes().getNamedItem("username").getNodeValue().equals(username)) { break; } } assert student != null; student.getParentNode().removeChild(student); UpdateModel.updateXML(new DOMSource(document), filePath); HomePage.clearHomePage(); Main.studentModel.removeStudent(); Main.scene.getStylesheets().removeAll(); Main.scene.getStylesheets().addAll("com/magis/app/css/style.css", "com/magis/app/css/lightmode.css", "com/magis/app/css/pink.css"); Main.isLoggedIn = false; } StudentModel(LessonModel lessonModel); Student getStudent(); void removeStudent(); void initializeStudent(String username); int addStudent(String username, String firstName, String lastName, String password, String salt); void deleteUser(String username); public File file; }### Answer:
@Test public void deleteUser() throws IOException { File file = getFile(); Files.deleteIfExists(file.toPath()); StudentModel studentModel = new StudentModel(new LessonModel()); studentModel.addStudent("ianspryn", "Ian", "Spryn", "null", "null"); studentModel.initializeStudent("ianspryn"); studentModel.deleteUser("ianspryn"); StudentModel.Student student = new StudentModel(new LessonModel()).getStudent(); Assert.assertNull(student); Files.deleteIfExists(file.toPath()); }