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;
  }
  private void validateForm(
      SdcctValidatorService validatorService, SdcctForm<?> testForm, boolean validExpected)
      throws Exception {
    String testFormName = testForm.getName(), testFormIdentifier = testForm.getIdentifier();

    try {
      // noinspection ConstantConditions
      validatorService.validate(
          this.xmlInFactory.createXMLStreamReader(testForm.getDocument().getSource()));
    } catch (ValidationException e) {
      LOGGER.trace(
          String.format(
              "Test form (name=%s, identifier=%s) was invalid:%s",
              testFormName,
              testFormIdentifier,
              e.getResult()
                  .getIssues()
                  .stream()
                  .map(testFormIssue -> String.format("\n{%s}", testFormIssue))
                  .collect(Collectors.joining(StringUtils.EMPTY))),
          e);

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

      return;
    }

    LOGGER.trace(
        String.format(
            "Test form (name=%s, identifier=%s) was valid.", testFormName, testFormIdentifier));

    Assert.assertTrue(
        validExpected,
        String.format(
            "Test form (name=%s, identifier=%s) was expected to be invalid.",
            testFormName, testFormIdentifier));
  }