@Override
 public int hashCode() {
   final int prime = 31;
   int result = super.hashCode();
   result = prime * result + ((approachBodySite == null) ? 0 : approachBodySite.hashCode());
   result = prime * result + ((deliveryMethod == null) ? 0 : deliveryMethod.hashCode());
   result = prime * result + ((deliveryRate == null) ? 0 : deliveryRate.hashCode());
   result = prime * result + ((deliveryRoute == null) ? 0 : deliveryRoute.hashCode());
   result = prime * result + ((doseQuantity == null) ? 0 : doseQuantity.hashCode());
   result = prime * result + ((dosingPeriod == null) ? 0 : dosingPeriod.hashCode());
   result =
       prime * result
           + ((dosingPeriodIntervalIsImportant == null)
               ? 0
               : dosingPeriodIntervalIsImportant.hashCode());
   result = prime * result + ((substance == null) ? 0 : substance.hashCode());
   result =
       prime * result
           + ((substanceAdministrationGeneralPurpose == null)
               ? 0
               : substanceAdministrationGeneralPurpose.hashCode());
   result = prime * result + ((targetBodySite == null) ? 0 : targetBodySite.hashCode());
   result = prime * result + ((doseType == null) ? 0 : doseType.hashCode());
   return result;
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (!super.equals(obj)) return false;
   if (getClass() != obj.getClass()) return false;
   SubstanceAdministrationBase other = (SubstanceAdministrationBase) obj;
   if (approachBodySite == null) {
     if (other.approachBodySite != null) return false;
   } else if (!approachBodySite.equals(other.approachBodySite)) return false;
   if (deliveryMethod == null) {
     if (other.deliveryMethod != null) return false;
   } else if (!deliveryMethod.equals(other.deliveryMethod)) return false;
   if (deliveryRate == null) {
     if (other.deliveryRate != null) return false;
   } else if (!deliveryRate.equals(other.deliveryRate)) return false;
   if (deliveryRoute == null) {
     if (other.deliveryRoute != null) return false;
   } else if (!deliveryRoute.equals(other.deliveryRoute)) return false;
   if (doseQuantity == null) {
     if (other.doseQuantity != null) return false;
   } else if (!doseQuantity.equals(other.doseQuantity)) return false;
   if (dosingPeriod == null) {
     if (other.dosingPeriod != null) return false;
   } else if (!dosingPeriod.equals(other.dosingPeriod)) return false;
   if (dosingPeriodIntervalIsImportant == null) {
     if (other.dosingPeriodIntervalIsImportant != null) return false;
   } else if (!dosingPeriodIntervalIsImportant.equals(other.dosingPeriodIntervalIsImportant))
     return false;
   if (substance == null) {
     if (other.substance != null) return false;
   } else if (!substance.equals(other.substance)) return false;
   if (substanceAdministrationGeneralPurpose == null) {
     if (other.substanceAdministrationGeneralPurpose != null) return false;
   } else if (!substanceAdministrationGeneralPurpose.equals(
       other.substanceAdministrationGeneralPurpose)) return false;
   if (targetBodySite == null) {
     if (other.targetBodySite != null) return false;
   } else if (!targetBodySite.equals(other.targetBodySite)) return false;
   if (doseType == null) {
     if (other.doseType != null) return false;
   } else if (!doseType.equals(other.doseType)) return false;
   return true;
 }
  @Override
  public void prepare(TestCase testCase) {

    facts = new ArrayList<Object>(maxStep);

    FactType observationResult =
        ksession.getKnowledgeBase().getFactType("opencds.test", "ObservationResult2");
    try {
      for (int j = 0; j < maxStep; j++) {

        Object obs = null;
        obs = observationResult.newInstance();
        CD cdFocus = new CD();
        cdFocus.setCodeSystem("AHRQ v4.3");
        cdFocus.setCode("10220");
        observationResult.set(
            obs, "id", "001" + Integer.toString(j)); // UUID.randomUUID().toString());
        observationResult.set(obs, "observationFocus", cdFocus);
        observationResult.set(obs, "subjectIsFocalPerson", true);

        CD cdCoded = new CD();
        cdCoded.setCodeSystem("AHRQ v4.3");
        cdCoded.setCode("34254");
        ObservationValue obsValue = new ObservationValue();
        obsValue.setConcept(cdCoded);
        obsValue.setIdentifier(UUID.randomUUID().toString());
        observationResult.set(obs, "observationValue", obsValue);

        facts.add(obs);
        ksession.insert(obs);
      }
    } catch (InstantiationException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    } catch (IllegalAccessException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
  }