### Question:
XMLUserDatabase extends AbstractUserDatabase { @Override public synchronized void deleteByLoginName( final String loginName ) throws NoSuchPrincipalException, WikiSecurityException { if( c_dom == null ) { throw new WikiSecurityException( "FATAL: database does not exist" ); } final NodeList users = c_dom.getDocumentElement().getElementsByTagName( USER_TAG ); for( int i = 0; i < users.getLength(); i++ ) { final Element user = ( Element )users.item( i ); if( user.getAttribute( LOGIN_NAME ).equals( loginName ) ) { c_dom.getDocumentElement().removeChild( user ); saveDOM(); return; } } throw new NoSuchPrincipalException( "Not in database: " + loginName ); }  @Override synchronized void deleteByLoginName( final String loginName ); @Override UserProfile findByEmail( final String index ); @Override UserProfile findByFullName( final String index ); @Override UserProfile findByLoginName( final String index ); @Override UserProfile findByUid( final String uid ); @Override UserProfile findByWikiName( final String index ); UserProfile findBy( final String attr, final String value ); @Override Principal[] getWikiNames(); @Override void initialize( final Engine engine, final Properties props ); @Override synchronized void rename( final String loginName, final String newName); @Override synchronized void save( final UserProfile profile ); static final String PROP_USERDATABASE; }### Answer:
@Test public void testDeleteByLoginName() throws WikiSecurityException { int oldUserCount = m_db.getWikiNames().length; String loginName = "TestUser" + String.valueOf( System.currentTimeMillis() ); UserProfile profile = m_db.newProfile(); profile.setEmail( "jspwiki.tests@mailinator.com" ); profile.setLoginName( loginName ); profile.setFullname( "FullName" + loginName ); profile.setPassword( "password" ); m_db.save( profile ); profile = m_db.findByLoginName( loginName ); Assertions.assertEquals( loginName, profile.getLoginName() ); Assertions.assertEquals( oldUserCount + 1, m_db.getWikiNames().length ); m_db.deleteByLoginName( loginName ); Assertions.assertEquals( oldUserCount, m_db.getWikiNames().length ); }