4646import org .junit .After ;
4747import org .junit .Assert ;
4848import org .junit .Before ;
49+ import org .junit .Ignore ;
4950import org .junit .Test ;
5051
5152import net .sourceforge .pmd .Rule ;
@@ -238,55 +239,58 @@ public void testProjectRuleSet1() throws PropertiesException, RuleSetNotFoundExc
238239
239240 final RuleSetFactory factory = new RuleSetFactory ();
240241
241- // use the basic ruleset because it should be included in the plugin
242- // ruleset.
243- final RuleSet basicRuleSet = factory .createRuleSet ("rulesets/java/basic.xml" );
242+ // use the best practices ruleset because it should be included in the plugin ruleset.
243+ final RuleSet bestPracticesRuleSet = factory .createRuleSet ("category/java/bestpractices.xml" );
244244
245245 // First set the project ruleset
246- model .setProjectRuleSet (basicRuleSet );
246+ model .setProjectRuleSet (bestPracticesRuleSet );
247247 model .sync ();
248248
249249 // Test the ruleset we set is equal to the ruleset we queried
250250 final RuleSet projectRuleSet = model .getProjectRuleSet ();
251251 Assert .assertNotNull ("Project ruleset has not been set" , projectRuleSet );
252252 Assert .assertTrue ("The project ruleset is not the basic ruleset" ,
253- EclipseUtils .assertRuleSetEquals (basicRuleSet .getRules (), projectRuleSet .getRules (), System .out ));
253+ EclipseUtils .assertRuleSetEquals (bestPracticesRuleSet .getRules (), projectRuleSet .getRules (), System .out ));
254254 }
255255
256256 /**
257257 * When rules are removed from the plugin preferences, these rules should also be removed from the project euh...
258258 * ben en fait non. annulé.
259259 */
260260 @ Test
261+ @ Ignore ("implementation is not finished - maybe the behavior would even be wrong" )
261262 public void testProjectRuleSet2 () throws PropertiesException , RuleSetNotFoundException , CoreException {
262- /*
263- * // First ensure that the plugin initial ruleset is equal to the project // ruleset IProjectPropertiesManager
264- * mgr = PMDPlugin.getDefault().getPropertiesManager(); IProjectProperties model =
265- * mgr.loadProjectProperties(this.testProject);
266- *
267- * RuleSet projectRuleSet = model.getProjectRuleSet();
268- * assertEquals("The project ruleset is not equal to the plugin ruleset", this.initialPluginRuleSet.getRules(),
269- * projectRuleSet .getRules());
270- *
271- * // use the basic ruleset and set it at the only plugin ruleset RuleSetFactory factory = new RuleSetFactory();
272- * RuleSet basicRuleSet = factory.createSingleRuleSet("rulesets/basic.xml");
273- *
274- * IPreferencesManager pmgr = PMDPlugin.getDefault().getPreferencesManager(); pmgr.setRuleSet(basicRuleSet);
275- *
276- * projectRuleSet = model.getProjectRuleSet();
277- *
278- * dumpRuleSet(basicRuleSet); dumpRuleSet(projectRuleSet);
279- * assertEquals("The project ruleset is not equal to the plugin ruleset", basicRuleSet.getRules(),
280- * projectRuleSet.getRules());
281- */
263+ // First ensure that the plugin initial ruleset is equal to the project
264+ // // ruleset IProjectPropertiesManager
265+ final IProjectPropertiesManager mgr = PMDPlugin .getDefault ().getPropertiesManager ();
266+ final IProjectProperties model = mgr .loadProjectProperties (this .testProject );
267+
268+ RuleSet projectRuleSet = model .getProjectRuleSet ();
269+ Assert .assertEquals ("The project ruleset is not equal to the plugin ruleset" ,
270+ this .initialPluginRuleSet .getRules (), projectRuleSet .getRules ());
271+
272+ final RuleSetFactory factory = new RuleSetFactory ();
273+
274+ // use the best practices ruleset because it should be included in the
275+ // plugin ruleset.
276+ final RuleSet bestPracticesRuleSet = factory .createRuleSet ("category/java/bestpractices.xml" );
277+
278+ IPreferencesManager pmgr = PMDPlugin .getDefault ().getPreferencesManager ();
279+ pmgr .setRuleSet (bestPracticesRuleSet );
280+
281+ projectRuleSet = model .getProjectRuleSet ();
282+
283+ dumpRuleSet (bestPracticesRuleSet );
284+ dumpRuleSet (projectRuleSet );
285+ Assert .assertEquals ("The project ruleset is not equal to the plugin ruleset" , bestPracticesRuleSet .getRules (),
286+ projectRuleSet .getRules ());
282287 }
283288
284289 /**
285290 * When rules are added to the plugin preferences, these rules should also be added to the project
286291 */
287292 @ Test
288293 public void testProjectRuleSet3 () throws PropertiesException , RuleSetNotFoundException , CoreException {
289-
290294 // First ensure that the plugin initial ruleset is equal to the project
291295 // ruleset
292296 final IProjectPropertiesManager mgr = PMDPlugin .getDefault ().getPropertiesManager ();
@@ -407,11 +411,11 @@ public void testRuleSetStoredInProjectFALSE() throws PropertiesException, RuleSe
407411 final IProjectProperties model = mgr .loadProjectProperties (this .testProject );
408412
409413 final RuleSetFactory factory = new RuleSetFactory ();
410- final RuleSet basicRuleSet = factory .createRuleSet ("rulesets /java/basic .xml" );
414+ final RuleSet bestPracticesRuleSet = factory .createRuleSet ("category /java/bestpractices .xml" );
411415 model .setPmdEnabled (true );
412416 model .setRuleSetStoredInProject (false );
413417 model .setProjectWorkingSet (null );
414- model .setProjectRuleSet (basicRuleSet );
418+ model .setProjectRuleSet (bestPracticesRuleSet );
415419 model .sync ();
416420
417421 model .createDefaultRuleSetFile ();
@@ -433,7 +437,7 @@ public void testRuleSetStoredInProjectTRUE() throws PropertiesException, RuleSet
433437 final IProjectProperties model = mgr .loadProjectProperties (this .testProject );
434438
435439 final RuleSetFactory factory = new RuleSetFactory ();
436- final RuleSet basicRuleSet = factory .createRuleSet ("rulesets /java/basic .xml" );
440+ final RuleSet basicRuleSet = factory .createRuleSet ("category /java/bestpractices .xml" );
437441 model .setPmdEnabled (true );
438442 model .setRuleSetStoredInProject (false );
439443 model .setProjectWorkingSet (null );
0 commit comments