@Test
public void testExecute_valid() throws Exception {

	// Prepare the command
	InstallPluginCommand itc = new InstallPluginCommand();
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	itc.out = new PrintStream( os, true, "UTF-8" );
	itc.targetName = "script";
	itc.roboconfVersion = "0.5";
	// Mock the session
	final String expected = "bundle:install --start mvn:net.roboconf/roboconf-plugin-script/0.5";
	Session session = Mockito.mock( Session.class );
	Mockito.when( session.execute( expected )).thenReturn( null );
	// Inject the session
	for( Class<?> c = itc.getClass(); c != null; c = c.getSuperclass()) {
		try {
			Field field = c.getDeclaredField( "session" );
			field.setAccessible( true );
			field.set( itc, session );
		} catch( NoSuchFieldException e ) {
			// nothing
		}
	}
	// Verify the execution
	itc.execute();
	String s = os.toString( "UTF-8" );
	Assert.assertFalse( s.contains( "the Roboconf version" ));
	Assert.assertFalse( s.contains( "Unknown plug-in" ));
	Mockito.verify( session ).execute( expected );
}