View Javadoc

1   /*
2    * Copyright 2024 Bloomreach B.V. (http://www.bloomreach.com)
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *         http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.onehippo.forge.gallerymagick.core.command;
17  
18  import java.io.File;
19  import java.net.URISyntaxException;
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  /**
24   * AbstractMagickCommandTest.
25   */
26  abstract public class AbstractMagickCommandTest {
27  
28      protected static final String [] DEFAULT_TEST_IMAGE_FILE_EXTENSIONS = { "jpg", "png", "gif", "bmp", "tiff" };
29  
30      private List<File> testImageFiles;
31  
32      protected String [] getTestImageFileExtensions() {
33          return DEFAULT_TEST_IMAGE_FILE_EXTENSIONS;
34      }
35  
36      protected List<File> getTestImageFiles() throws URISyntaxException {
37          if (testImageFiles == null) {
38              testImageFiles = new ArrayList<>();
39  
40              for (String extension : getTestImageFileExtensions()) {
41                  testImageFiles.add(new File(AbstractMagickCommandTest.class.getResource("/hippo." + extension).toURI()));
42              }
43          }
44  
45          return testImageFiles;
46      }
47  
48  }