private static SdcctForm<?> buildForm(SdcctForm<?> testForm, boolean buildableExpected)
      throws Exception {
    String testFormName = testForm.getName(), testFormIdentifier = testForm.getIdentifier();

    if (testForm.hasDocument()) {
      return testForm;
    }

    try {
      testForm.build();
    } catch (Exception e) {
      LOGGER.trace(
          String.format(
              "Test form (name=%s, identifier=%s) was not buildable.",
              testFormName, testFormIdentifier),
          e);

      Assert.assertFalse(
          buildableExpected,
          String.format(
              "Test form (name=%s, identifier=%s) was expected to be buildable.",
              testFormName, testFormIdentifier));

      return testForm;
    }

    Assert.assertTrue(
        buildableExpected,
        String.format(
            "Test form (name=%s, identifier=%s) was expected to not be buildable.",
            testFormName, testFormIdentifier));

    return testForm;
  }