### Question:
XMLUserDatabase extends AbstractUserDatabase { @Override public Principal[] getWikiNames() throws WikiSecurityException { if ( c_dom == null ) { throw new IllegalStateException( "FATAL: database does not exist" ); } final SortedSet< Principal > principals = new TreeSet<>(); final NodeList users = c_dom.getElementsByTagName( USER_TAG ); for( int i = 0; i < users.getLength(); i++ ) { final Element user = (Element) users.item( i ); final String wikiName = user.getAttribute( WIKI_NAME ); if( wikiName == null ) { log.warn( "Detected null wiki name in XMLUserDataBase. Check your user database." ); } else { final Principal principal = new WikiPrincipal( wikiName, WikiPrincipal.WIKI_NAME ); principals.add( principal ); } } return principals.toArray( new Principal[principals.size()] ); }  @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 testGetWikiNames() throws WikiSecurityException { Principal[] p = m_db.getWikiNames(); Assertions.assertEquals( 8, p.length ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "JanneJalkanen", WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "", WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "Administrator", WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.ALICE, WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BOB, WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.CHARLIE, WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( "FredFlintstone", WikiPrincipal.WIKI_NAME ) ) ); Assertions.assertTrue( ArrayUtils.contains( p, new WikiPrincipal( Users.BIFF, WikiPrincipal.WIKI_NAME ) ) ); }