You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IntermediateFormatTestSuite.java 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.intermediate;
  19. import java.io.File;
  20. import java.io.FilenameFilter;
  21. import java.io.IOException;
  22. import javax.xml.transform.TransformerFactory;
  23. import junit.framework.Test;
  24. import junit.framework.TestSuite;
  25. /**
  26. * A test suite for testing the Intermediate Format output.
  27. */
  28. public final class IntermediateFormatTestSuite {
  29. private IntermediateFormatTestSuite() {
  30. // This is a utility class
  31. }
  32. /**
  33. * Creates a suite of Intermediate Format tests.
  34. *
  35. * @return the test suite
  36. * @throws IOException if an I/O error occurs while loading one of the tests
  37. */
  38. public static Test suite() throws IOException {
  39. File backupDir = new File("build/test-results/intermediate");
  40. backupDir.mkdirs();
  41. IFTester ifTester = new IFTester(TransformerFactory.newInstance(), backupDir);
  42. TestSuite suite = new TestSuite();
  43. File testDir = new File("test/intermediate");
  44. String[] tests = testDir.list(new FilenameFilter() {
  45. public boolean accept(File dir, String name) {
  46. return name.endsWith(".xml");
  47. }
  48. });
  49. for (String test : tests) {
  50. File testFile = new File(testDir, test);
  51. suite.addTest(new IFTestCase(testFile, ifTester));
  52. }
  53. return suite;
  54. }
  55. }