@Before
  public void setup() {
    survey = new Survey();
    survey.setName("my survey");
    for (RecordPropertyType type : RecordPropertyType.values()) {
      RecordProperty p = new RecordProperty(survey, type, mdDAO);
      p.setRequired(false);
    }

    List<Attribute> attrList = new ArrayList<Attribute>();

    attr = new Attribute();
    attr.setName("speciesattr");
    attr.setDescription("species attribute");
    attr.setTypeCode(AttributeType.SPECIES.getCode());
    attr.setRequired(true);

    attrList.add(attr);

    taxaDAO.save(attr);

    survey.setAttributes(attrList);

    surveyDAO.save(survey);
  }
  @Before
  public void setUp() throws Exception {
    taxonGroup = new TaxonGroup();
    taxonGroup.setName("Birds");
    taxonGroup = taxaDAO.save(taxonGroup);

    speciesA = new IndicatorSpecies();
    speciesA.setCommonName("Indicator Species A");
    speciesA.setScientificName("Indicator Species A");
    speciesA.setTaxonGroup(taxonGroup);
    speciesA = taxaDAO.save(speciesA);

    speciesB = new IndicatorSpecies();
    speciesB.setCommonName("Indicator Species B");
    speciesB.setScientificName("Indicator Species B");
    speciesB.setTaxonGroup(taxonGroup);
    speciesB = taxaDAO.save(speciesB);

    List<Attribute> attributeList = new ArrayList<Attribute>();
    Attribute attr;
    for (AttributeType attrType : AttributeType.values()) {
      for (AttributeScope scope :
          new AttributeScope[] {AttributeScope.RECORD, AttributeScope.SURVEY, null}) {

        attr = new Attribute();
        attr.setRequired(true);
        attr.setName(attrType.toString());
        attr.setTypeCode(attrType.getCode());
        attr.setScope(scope);
        attr.setTag(false);

        if (AttributeType.STRING_WITH_VALID_VALUES.equals(attrType)) {
          List<AttributeOption> optionList = new ArrayList<AttributeOption>();
          for (int i = 0; i < 4; i++) {
            AttributeOption opt = new AttributeOption();
            opt.setValue(String.format("Option %d", i));
            opt = taxaDAO.save(opt);
            optionList.add(opt);
          }
          attr.setOptions(optionList);
        }

        attr = taxaDAO.save(attr);
        attributeList.add(attr);
      }
    }

    survey = new Survey();
    survey.setName("SingleSiteMultiTaxaSurvey 1234");
    survey.setActive(true);
    survey.setStartDate(new Date());
    survey.setDescription("Single Site Multi Taxa Survey Description");
    Metadata md = survey.setFormRendererType(SurveyFormRendererType.SINGLE_SITE_MULTI_TAXA);
    metadataDAO.save(md);
    survey.setAttributes(attributeList);
    survey = surveyDAO.save(survey);
  }