@Test
  public void testDataRuleDefinitionBean() {
    com.streamsets.datacollector.config.DataRuleDefinition dataRuleDefinition =
        new com.streamsets.datacollector.config.DataRuleDefinition(
            "nameNotNull",
            "nameNotNull",
            "lane",
            100,
            10,
            "${record:value(\"/name\")==null}",
            true,
            "nameNotNull",
            com.streamsets.datacollector.config.ThresholdType.COUNT,
            "2",
            5,
            true,
            false,
            true);

    DataRuleDefinitionJson dataRuleDefinitionJsonBean =
        new DataRuleDefinitionJson(dataRuleDefinition);

    Assert.assertEquals(dataRuleDefinition.getLabel(), dataRuleDefinitionJsonBean.getLabel());
    Assert.assertEquals(dataRuleDefinition.getLane(), dataRuleDefinitionJsonBean.getLane());
    Assert.assertEquals(
        dataRuleDefinition.getMinVolume(), dataRuleDefinitionJsonBean.getMinVolume());
    Assert.assertTrue(
        dataRuleDefinition.getSamplingPercentage()
            == dataRuleDefinitionJsonBean.getSamplingPercentage());
    Assert.assertEquals(
        dataRuleDefinition.getSamplingRecordsToRetain(),
        dataRuleDefinitionJsonBean.getSamplingRecordsToRetain());
    Assert.assertEquals(
        dataRuleDefinition.getThresholdType(),
        BeanHelper.unwrapThresholdType(dataRuleDefinitionJsonBean.getThresholdType()));
    Assert.assertEquals(
        dataRuleDefinition.getThresholdValue(), dataRuleDefinitionJsonBean.getThresholdValue());
    Assert.assertEquals(
        dataRuleDefinition.getAlertText(), dataRuleDefinitionJsonBean.getAlertText());
    Assert.assertEquals(dataRuleDefinition.getId(), dataRuleDefinitionJsonBean.getId());
    Assert.assertEquals(
        dataRuleDefinition.getCondition(), dataRuleDefinitionJsonBean.getCondition());
    Assert.assertEquals(
        dataRuleDefinition.isAlertEnabled(), dataRuleDefinitionJsonBean.isAlertEnabled());
    Assert.assertEquals(
        dataRuleDefinition.isMeterEnabled(), dataRuleDefinitionJsonBean.isMeterEnabled());
    Assert.assertEquals(dataRuleDefinition.isSendEmail(), dataRuleDefinitionJsonBean.isSendEmail());
    Assert.assertEquals(dataRuleDefinition.isValid(), dataRuleDefinitionJsonBean.isValid());
    Assert.assertEquals(dataRuleDefinition.isEnabled(), dataRuleDefinitionJsonBean.isEnabled());
  }
 public static DataRuleDefinition cloneRuleWithResolvedAlertText(
     DataRuleDefinition def, String alterInfo) {
   return new DataRuleDefinition(
       def.getFamily(),
       def.getId(),
       def.getLabel(),
       def.getLane(),
       def.getSamplingPercentage(),
       def.getSamplingRecordsToRetain(),
       def.getCondition(),
       def.isAlertEnabled(),
       alterInfo,
       def.getThresholdType(),
       def.getThresholdValue(),
       def.getMinVolume(),
       def.isMeterEnabled(),
       def.isSendEmail(),
       def.isAlertEnabled(),
       def.getTimestamp());
 }