@Test public void testEmptyModel() { final ScoreCardModel model = new ScoreCardModel(); model.setName("test"); final String drl = GuidedScoreCardDRLPersistence.marshal(model); assertNotNull(drl); assertFalse(drl.contains("package")); assertEquals(11, StringUtil.countMatches(drl, "rule \"")); assertEquals(2, StringUtil.countMatches(drl, "import ")); }
@Test public void testEmptyModelInPackage() { final ScoreCardModel model = new ScoreCardModel(); model.setName("test"); model.setPackageName("org.drools.workbench.models.guided.scorecard.backend"); final String drl = GuidedScoreCardDRLPersistence.marshal(model); assertNotNull(drl); assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend")); assertEquals(11, StringUtil.countMatches(drl, "rule \"")); assertEquals(2, StringUtil.countMatches(drl, "import ")); }
@Test public void testModelWithImportsAndFactName() { final ScoreCardModel model = new ScoreCardModel(); model.setName("test"); model.setPackageName("org.drools.workbench.models.guided.scorecard.backend"); model.getImports().addImport(new Import("org.smurf.Pupa")); model.setFactName("org.drools.MoreCheese"); final String drl = GuidedScoreCardDRLPersistence.marshal(model); assertNotNull(drl); assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend")); assertEquals(11, StringUtil.countMatches(drl, "rule \"")); assertEquals(3, StringUtil.countMatches(drl, "import ")); }