private void verifySummaryBreaksOnReusableDropdowns(boolean withDetail)
      throws Exception, IOException {
    ReusableChoices choices = new ReusableChoices("choicescode", "Choices Label");
    String aLabel = "Fabulous A";
    choices.add(new ChoiceItem("a", aLabel));
    String bLabel = "Excellent B";
    choices.add(new ChoiceItem("b", bLabel));
    MockMartusApp app = MockMartusApp.create();
    FieldSpecCollection defaultSpecs = app.getStore().getTopSectionFieldSpecs();
    FieldSpecCollection specs = new FieldSpecCollection();
    for (int i = 0; i < defaultSpecs.size(); ++i) specs.add(defaultSpecs.get(i));
    specs.addReusableChoiceList(choices);
    CustomDropDownFieldSpec dropdown = new CustomDropDownFieldSpec();
    dropdown.setTag("dd");
    dropdown.setLabel("Dropdown");
    dropdown.addReusableChoicesCode(choices.getCode());
    specs.add(dropdown);
    app.getStore().setTopSectionFieldSpecs(specs);

    Bulletin b1 = app.createBulletin();
    b1.set(dropdown.getTag(), "a");
    app.saveBulletin(b1, app.getStore().getFolderSaved());
    Bulletin b2 = app.createBulletin();
    b2.set(dropdown.getTag(), "b");
    app.saveBulletin(b2, app.getStore().getFolderSaved());

    MiniLocalization localization = new MiniLocalization();
    MiniFieldSpec[] sortSpecs = new MiniFieldSpec[] {new MiniFieldSpec(dropdown)};
    localization.setCurrentLanguageCode("en");
    ReportFormat report = new TabularReportBuilder(localization).createTabular(sortSpecs);
    ReportOutput destination = new ReportOutput();
    RunReportOptions options = new RunReportOptions();
    options.hideDetail = withDetail;
    options.printBreaks = true;
    options.includePrivate = true;
    ReportRunner runner = new ReportRunner(app.getSecurity(), new MiniLocalization());
    SortableBulletinList bulletins = new SortableBulletinList(localization, sortSpecs);
    bulletins.add(b1);
    bulletins.add(b2);
    runner.runReport(
        report,
        app.getStore().getDatabase(),
        bulletins,
        destination,
        options,
        specs.getAllReusableChoiceLists());
    destination.close();
    String result = destination.getPrintableDocument();
    assertContains(withDetail + " Wrote code instead of label a?", aLabel, result);
    assertContains(withDetail + " Wrote code instead of label b?", bLabel, result);
  }
 private void createAndSaveSampleBulletin(
     MockMartusApp app, String author, String summary, String entryDate) throws Exception {
   BulletinFolder outbox = app.getFolderDraftOutbox();
   Bulletin b = app.createBulletin();
   b.set(Bulletin.TAGAUTHOR, author);
   b.set(Bulletin.TAGSUMMARY, summary);
   b.set(Bulletin.TAGENTRYDATE, entryDate);
   app.saveBulletin(b, outbox);
 }