### Question:
UndefinedPagesPlugin extends AbstractReferralPlugin { @Override public String execute( final Context context, final Map< String, String > params ) throws PluginException { final ReferenceManager refmgr = context.getEngine().getManager( ReferenceManager.class ); super.initialize( context, params ); Collection< String > links = refmgr.findUncreated(); links = filterAndSortCollection( links ); if( m_lastModified ) { throw new PluginException( "parameter " + PARAM_LASTMODIFIED + " is not valid for the UndefinedPagesPlugin" ); } final String wikitext; if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) ) { wikitext = "" + links.size(); } else { wikitext = wikitizeCollection( links, m_separator, ALL_ITEMS ); } return makeHTML( context, wikitext ); }  @Override String execute( final Context context, final Map< String, String > params );  }### Answer:
@Test public void testSimpleUndefined() throws Exception { final Context context2 = Wiki.context().create( testEngine, Wiki.contents().page( testEngine, "Foobar" ) ); final String res = manager.execute( context2,"{INSERT org.apache.wiki.plugin.UndefinedPagesPlugin" ); final String exp = "[Foobar 2]\\\\"; Assertions.assertEquals( wikitize( exp ), res ); }
@Test public void testCount() throws Exception { final String result = manager.execute( context, "{UndefinedPagesPlugin show=count}"); Assertions.assertEquals("1", result ); final String expectedExceptionString = "parameter showLastModified is not valid for the UndefinedPagesPlugin"; String exceptionString = null; try { manager.execute( context, "{UndefinedPagesPlugin,show=count,showLastModified=true}" ); } catch( final PluginException pe ) { exceptionString = pe.getMessage(); } Assertions.assertEquals( expectedExceptionString, exceptionString ); }