// Path: src/test/java/org/jboss/elasticsearch/tools/content/testtools/TestUtils.java
// public abstract class TestUtils {
// 
// 	/**
// 	 * Assert passed string is same as contnt of given file loaded from classpath.
// 	 * 
// 	 * @param expectedFilePath path to file inside classpath
// 	 * @param actual content to assert
// 	 * @throws IOException
// 	 */
// 	public static void assertStringFromClasspathFile(String expectedFilePath, String actual) throws IOException {
// 		Assert.assertEquals(readStringFromClasspathFile(expectedFilePath), actual);
// 	}
// 
// 	/**
// 	 * Read file from classpath into String. UTF-8 encoding expected.
// 	 * 
// 	 * @param filePath in classpath to read data from.
// 	 * @return file content.
// 	 * @throws IOException
// 	 */
// 	public static String readStringFromClasspathFile(String filePath) throws IOException {
// 		StringWriter stringWriter = new StringWriter();
// 		IOUtils.copy(TestUtils.class.getResourceAsStream(filePath), stringWriter, "UTF-8");
// 		return stringWriter.toString();
// 	}
// 
// 	/**
// 	 * Read JSON file from classpath into Map of Map structure.
// 	 * 
// 	 * @param filePath path in classpath pointing to JSON file to read
// 	 * @return parsed JSON file
// 	 * @throws SettingsException
// 	 */
// 	public static Map<String, Object> loadJSONFromClasspathFile(String filePath) throws SettingsException {
// 		XContentParser parser = null;
// 		try {
// 			parser = XContentFactory.xContent(XContentType.JSON).createParser(TestUtils.class.getResourceAsStream(filePath));
// 			return parser.mapAndClose();
// 		} catch (IOException e) {
// 			throw new SettingsException(e.getMessage(), e);
// 		} finally {
// 			if (parser != null)
// 				parser.close();
// 		}
// 	}
// 
// }


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.settings.SettingsException;
import org.jboss.elasticsearch.tools.content.testtools.TestUtils;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
		Mockito.doCallRealMethod().when(tested).preprocessData(Mockito.anyMap(), Mockito.any(PreprocessChainContext.class));
		Mockito.doCallRealMethod().when(tested).getSourceBases();
		Map<String, Object> settings = new HashMap<String, Object>();
		tested.init(settings);

		Map<String, Object> data = new HashMap<String, Object>();
		Assert.assertEquals(data, tested.preprocessData(data, null));

		Mockito.verify(tested).init(settings);
		Mockito.verify(tested).preprocessData(data, null);
		Mockito.verify(tested).processOneSourceValue(data, null, null, null);
		Mockito.verify(tested, Mockito.times(0)).createContext(Mockito.anyMap());
		Mockito.verifyNoMoreInteractions(tested);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Test
	public void preprocessData_bases() {
		StructuredContentPreprocessorWithSourceBasesBase tested = Mockito
				.mock(StructuredContentPreprocessorWithSourceBasesBase.class);
		tested.name = "mypreproc";
		Mockito.doCallRealMethod().when(tested).init(Mockito.anyMap());
		Mockito.doCallRealMethod().when(tested).preprocessData(Mockito.anyMap(), Mockito.any(PreprocessChainContext.class));
		Mockito.doCallRealMethod().when(tested).getSourceBases();
		Mockito.doCallRealMethod().when(tested)
				.addDataWarning(Mockito.any(PreprocessChainContext.class), Mockito.anyString());
		tested.logger = Mockito.mock(ESLogger.class);
		Object mockContext = new Object();
		Mockito.when(tested.createContext(Mockito.anyMap())).thenReturn(mockContext);

// Path: src/test/java/org/jboss/elasticsearch/tools/content/testtools/TestUtils.java
// public abstract class TestUtils {
// 
// 	/**
// 	 * Assert passed string is same as contnt of given file loaded from classpath.
// 	 * 
// 	 * @param expectedFilePath path to file inside classpath
// 	 * @param actual content to assert
// 	 * @throws IOException
// 	 */
// 	public static void assertStringFromClasspathFile(String expectedFilePath, String actual) throws IOException {
// 		Assert.assertEquals(readStringFromClasspathFile(expectedFilePath), actual);
// 	}
// 
// 	/**
// 	 * Read file from classpath into String. UTF-8 encoding expected.
// 	 * 
// 	 * @param filePath in classpath to read data from.
// 	 * @return file content.
// 	 * @throws IOException
// 	 */
// 	public static String readStringFromClasspathFile(String filePath) throws IOException {
// 		StringWriter stringWriter = new StringWriter();
// 		IOUtils.copy(TestUtils.class.getResourceAsStream(filePath), stringWriter, "UTF-8");
// 		return stringWriter.toString();
// 	}
// 
// 	/**
// 	 * Read JSON file from classpath into Map of Map structure.
// 	 * 
// 	 * @param filePath path in classpath pointing to JSON file to read
// 	 * @return parsed JSON file
// 	 * @throws SettingsException
// 	 */
// 	public static Map<String, Object> loadJSONFromClasspathFile(String filePath) throws SettingsException {
// 		XContentParser parser = null;
// 		try {
// 			parser = XContentFactory.xContent(XContentType.JSON).createParser(TestUtils.class.getResourceAsStream(filePath));
// 			return parser.mapAndClose();
// 		} catch (IOException e) {
// 			throw new SettingsException(e.getMessage(), e);
// 		} finally {
// 			if (parser != null)
// 				parser.close();
// 		}
// 	}
// 
// }


// Path: src/test/java/org/jboss/elasticsearch/tools/content/StructuredContentPreprocessorWithSourceBasesBaseTest.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.settings.SettingsException;
import org.jboss.elasticsearch.tools.content.testtools.TestUtils;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

		Mockito.doCallRealMethod().when(tested).preprocessData(Mockito.anyMap(), Mockito.any(PreprocessChainContext.class));
		Mockito.doCallRealMethod().when(tested).getSourceBases();
		Map<String, Object> settings = new HashMap<String, Object>();
		tested.init(settings);

		Map<String, Object> data = new HashMap<String, Object>();
		Assert.assertEquals(data, tested.preprocessData(data, null));

		Mockito.verify(tested).init(settings);
		Mockito.verify(tested).preprocessData(data, null);
		Mockito.verify(tested).processOneSourceValue(data, null, null, null);
		Mockito.verify(tested, Mockito.times(0)).createContext(Mockito.anyMap());
		Mockito.verifyNoMoreInteractions(tested);
	}

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Test
	public void preprocessData_bases() {
		StructuredContentPreprocessorWithSourceBasesBase tested = Mockito
				.mock(StructuredContentPreprocessorWithSourceBasesBase.class);
		tested.name = "mypreproc";
		Mockito.doCallRealMethod().when(tested).init(Mockito.anyMap());
		Mockito.doCallRealMethod().when(tested).preprocessData(Mockito.anyMap(), Mockito.any(PreprocessChainContext.class));
		Mockito.doCallRealMethod().when(tested).getSourceBases();
		Mockito.doCallRealMethod().when(tested)
				.addDataWarning(Mockito.any(PreprocessChainContext.class), Mockito.anyString());
		tested.logger = Mockito.mock(ESLogger.class);
		Object mockContext = new Object();
		Mockito.when(tested.createContext(Mockito.anyMap())).thenReturn(mockContext);

		Map<String, Object> settings = TestUtils.loadJSONFromClasspathFile("/ESLookupValue_preprocessData-bases.json");