@Test
public void testComplete() {

	// Mock what is required
	Session session = Mockito.mock( Session.class );
	CommandLine commandLine = Mockito.mock( CommandLine.class );
	Mockito.when( commandLine.getCursorArgument()).thenReturn( "" );
	Mockito.when( commandLine.getArgumentPosition()).thenReturn( 0 );
	// Nothing typed in yet
	PluginCompleter completer = new PluginCompleter();
	List<String> candidates = new ArrayList<> ();
	Assert.assertEquals( 0, candidates.size());
	Assert.assertEquals( 0, completer.complete( session, commandLine, candidates ));
	Assert.assertEquals( SupportedPlugin.allString().size(), candidates.size());
	// Complete "f"
	candidates = new ArrayList<> ();
	Mockito.when( commandLine.getCursorArgument()).thenReturn( "f" );
	Mockito.when( commandLine.getArgumentPosition()).thenReturn( 1 ); // "f".length()
	Assert.assertEquals( 0, candidates.size());
	Assert.assertEquals( -1, completer.complete( session, commandLine, candidates ));
	Assert.assertEquals( 1, candidates.size());
	Assert.assertEquals( SupportedPlugin.FILE.toString().toLowerCase(), candidates.get( 0 ).trim());
	// Complete "FI" (case insensitive)
	candidates = new ArrayList<> ();
	Mockito.when( commandLine.getCursorArgument()).thenReturn( "FI" );
	Mockito.when( commandLine.getArgumentPosition()).thenReturn( 2 ); // "FI".length()
	Assert.assertEquals( 0, candidates.size());
	Assert.assertEquals( -2, completer.complete( session, commandLine, candidates ));
	Assert.assertEquals( 1, candidates.size());
	Assert.assertEquals( SupportedPlugin.FILE.toString().toLowerCase(), candidates.get( 0 ).trim());
	// Unknown
	candidates = new ArrayList<> ();
	Mockito.when( commandLine.getCursorArgument()).thenReturn( "unknown" );
	Mockito.when( commandLine.getArgumentPosition()).thenReturn( "unknown".length());
	Assert.assertEquals( 0, candidates.size());
	Assert.assertEquals( -1, completer.complete( session, commandLine, candidates ));
}