コード例 #1
0
  @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 "));
  }
コード例 #2
0
  @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 "));
  }
コード例 #3
0
  @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 "));
  }