<commit_before>/*
 *  -------------------------------------------------------------------------------

	This code is licensed under the Apache License, Version 2.0 (the "License"); 
	You may not use this file except in compliance with the License. 

	You may obtain a copy of the License at 

	http://www.apache.org/licenses/LICENSE-2.0 

	Unless required by applicable law or agreed to in writing, software 
	distributed under the License is distributed on an "AS IS" BASIS, 
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
	See the License for the specific language governing permissions and 
	limitations under the License.
	
 *  -------------------------------------------------------------------------------
 */
package de.thischwa.jii.core;

import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import de.thischwa.jii.IDimensionProvider;
import de.thischwa.jii.ImageFileInfo;
import de.thischwa.jii.ImageType;
import de.thischwa.jii.PropertiesHolder;
import de.thischwa.jii.core.ImageInfoWrapper;
import de.thischwa.jii.core.ImageMagickWrapper;
import de.thischwa.jii.core.SimpleImageInfoWrapper;
import de.thischwa.jii.core.iTextImageWrapper;

@RunWith(value = Parameterized.class)
public class TestDimensionProviderWrappers {
	private IDimensionProvider dp;

	public TestDimensionProviderWrappers(IDimensionProvider dp) {
		this.dp = dp;
	}

	@Parameters
	public static Collection<IDimensionProvider[]> data() {
		String commandDirIM = PropertiesHolder.get("im.command");
		IDimensionProvider[][] providers = new IDimensionProvider[][] { 
				{ new ImageMagickWrapper(commandDirIM) }, 
				{ new ImageInfoWrapper() }, 
				{ new SimpleImageInfoWrapper() },
				{ new iTextImageWrapper() } };
		return Arrays.asList(providers);
	}

	@Test
	public void testGetDimension() throws Exception {
		List<ImageType> supportedImageTypes = Arrays.asList(dp.getSupportedTypes());
		ImageFileInfo[] infos = ImageFileInfo.getAll();
		for (ImageFileInfo info : infos) {
			if (!supportedImageTypes.contains(info.getImageType()))
				continue;
			dp.set(info.getFile());
			assertEquals(info.getFile().getName(), info.getDimension(), dp.getDimension());
		}
	}
}
<commit_msg>added check for image type<commit_after>/*
 *  -------------------------------------------------------------------------------

	This code is licensed under the Apache License, Version 2.0 (the "License"); 
	You may not use this file except in compliance with the License. 

	You may obtain a copy of the License at 

	http://www.apache.org/licenses/LICENSE-2.0 

	Unless required by applicable law or agreed to in writing, software 
	distributed under the License is distributed on an "AS IS" BASIS, 
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
	See the License for the specific language governing permissions and 
	limitations under the License.
	
 *  -------------------------------------------------------------------------------
 */
package de.thischwa.jii.core;

import static org.junit.Assert.*;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import de.thischwa.jii.IDimensionProvider;
import de.thischwa.jii.ImageFileInfo;
import de.thischwa.jii.ImageType;
import de.thischwa.jii.PropertiesHolder;
import de.thischwa.jii.core.ImageInfoWrapper;
import de.thischwa.jii.core.ImageMagickWrapper;
import de.thischwa.jii.core.SimpleImageInfoWrapper;
import de.thischwa.jii.core.iTextImageWrapper;

@RunWith(value = Parameterized.class)
public class TestDimensionProviderWrappers {
	private IDimensionProvider dp;

	public TestDimensionProviderWrappers(IDimensionProvider dp) {
		this.dp = dp;
	}

	@Parameters
	public static Collection<IDimensionProvider[]> data() {
		String commandDirIM = PropertiesHolder.get("im.command");
		IDimensionProvider[][] providers = new IDimensionProvider[][] { 
				{ new ImageMagickWrapper(commandDirIM) }, 
				{ new ImageInfoWrapper() }, 
				{ new SimpleImageInfoWrapper() },
				{ new iTextImageWrapper() },
				{ new ImageIOWrapper() } };
		return Arrays.asList(providers);
	}

	@Test
	public void testGetDimension() throws Exception {
		List<ImageType> supportedImageTypes = Arrays.asList(dp.getSupportedTypes());
		ImageFileInfo[] infos = ImageFileInfo.getAll();
		for (ImageFileInfo info : infos) {
			if (!supportedImageTypes.contains(info.getImageType()))
				continue;
			dp.set(info.getFile());
			assertEquals(info.getFile().getName(), info.getDimension(), dp.getDimension());
			assertEquals(info.getFile().getName(), info.getImageType(), dp.getImageType());
		}
	}
}

{'fraction_non_alphanumeric': 0.16220600162206, 'fraction_numerical': 0.0016220600162206002, 'mean_word_length': 3.4642533936651585, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1891509', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1389, 'n_words': 359}