package de.superx.stat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.nio.file.Files; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import org.apache.commons.dbcp.BasicDataSource; import org.jdom2.Element; import org.jdom2.Namespace; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Strings; import de.statspez.plausi.generated.Plausi_ERHEBUNG_GASTHOERER_2019; import de.statspez.plausi.generated.Plausi_ERHEBUNG_PROMOVIERENDE_AB_2017; import de.statspez.plausi.generated.Plausi_ERHEBUNG_STUDENTEN_PRUEFUNGEN_AB_2017; import de.superx.db.H2InMemoryCreator; import de.superx.stat.StatisticExport.ExportFormat; import de.superx.util.XmlUtil; /** * Method to test {@link de.superx.stat.StatisticExport} * * @version 1.0 */ public class StatisticExportTest { private final static String EXAMINATION_AND_STUDENTS_PLAUSI_CLASSES_DATE = "20260218_115134"; private final static String DOCTORAL_CANDIDATE_PLAUSI_CLASSES_DATE = "20260226_134442"; private final static String GUEST_PLAUSI_CLASSES_DATE = "20260226_082349"; private static Logger logger = LoggerFactory.getLogger(StatisticExportTest.class); private static final String TMP_DIR = System.getProperty("java.io.tmpdir"); // Windows: // C:\Users\{user}\AppData\Local\Temp\ private static BasicDataSource dataSource; private static HashMap testClassInstances; /** * Generate a map of instances used within this test class (for better * maintenance). */ @BeforeClass public static void initTestClassInstances() { testClassInstances = new HashMap<>(); testClassInstances.put(DistributionType.STUDENTS2016, new StatisticExport(DistributionType.STUDENTS2016, new File("superx/WEB-INF/conf/edustore/db/module/astat/etl/statistik2016").getAbsolutePath(), null)); testClassInstances.put(DistributionType.EXAMINATIONS2016, new StatisticExport(DistributionType.EXAMINATIONS2016, new File("superx/WEB-INF/conf/edustore/db/module/astat/etl/statistik2016").getAbsolutePath(), null)); testClassInstances.put(DistributionType.EXAMINATIONS2016_SHORT, new StatisticExport(DistributionType.EXAMINATIONS2016_SHORT, new File("superx/WEB-INF/conf/edustore/db/module/astat/etl/statistik2016").getAbsolutePath(), null)); testClassInstances.put(DistributionType.GUEST_LISTENERS2019, new StatisticExport(DistributionType.GUEST_LISTENERS2019, new File("superx/WEB-INF/conf/edustore/db/module/astat/etl/statistik2016").getAbsolutePath(), null)); testClassInstances.put(DistributionType.DOCTORAL_CANDIDATE, new StatisticExport(DistributionType.DOCTORAL_CANDIDATE, new File("superx/WEB-INF/conf/edustore/db/module/prom/etl/stat_prom2017").getAbsolutePath(), null)); } /** * Test case for testing csv export of student statistics 2016 * #186046 * * @author hiber * * @throws Exception */ @Test public void testStudentStatistics2016CsvExport() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/students"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.STUDENTS2016); statisticExport.setDataSource(dataSource); // export file File exportCsvFile = new File(TMP_DIR, "junit_student_statistic_2016.csv"); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(exportCsvFile)); statisticExport.getCsvData(outputStream); // read file and check List fileContent = Files.readAllLines(exportCsvFile.toPath()); String[] firstRow = fileContent.get(0).split(";", -1); validateCsvFileStructure(firstRow, StudentAndExaminationStatistics2016.fieldSet, StudentAndExaminationStatistics2016.fieldLength); int rowCount = getRowCount(); assertEquals("database and unload file have the same row count", rowCount, fileContent.size()); } @Ignore @Test @SuppressWarnings("static-method") public void testGetInspectionReportForStudentStatistics2016CsvExport() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/students"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.STUDENTS2016); statisticExport.setDataSource(dataSource); String xmlFileName = "test/resources/schema_files/students_and_examination_statistics/xml_export/Pruefungen_statistik_SoSe_2025_202512.xml"; statisticExport.getInspectionReport(new FileInputStream(xmlFileName), 4); } /** * Test case for testing csv export of examination statistics 2016 * #186046 * * @author hiber * * @throws Exception */ @Test public void testExaminationStatistics2016CsvExport() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/examinations"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.EXAMINATIONS2016); statisticExport.setDataSource(dataSource); // export file File exportCsvFile = new File(TMP_DIR, "junit_examination_statistic_2016.csv"); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(exportCsvFile)); statisticExport.getCsvData(outputStream); // read file and check List fileContent = Files.readAllLines(exportCsvFile.toPath()); String[] firstRow = fileContent.get(0).split(";", -1); validateCsvFileStructure(firstRow, StudentAndExaminationStatistics2016.fieldSet, StudentAndExaminationStatistics2016.fieldLength); int rowCount = getRowCount(); assertEquals("database and unload file have the same row count", rowCount, fileContent.size()); } /** * Test case for testing csv export of examination statistics 2016 (short data set) * #186046 * * @author hiber * * @throws Exception */ @Test public void testExaminationStatistics2016ShortCsvExport() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/examinations"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.EXAMINATIONS2016_SHORT); statisticExport.setDataSource(dataSource); // export file File exportCsvFile = new File(TMP_DIR, "junit_examination_statistic_short_2016.csv"); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(exportCsvFile)); statisticExport.getCsvData(outputStream); // read file and check List fileContent = Files.readAllLines(exportCsvFile.toPath()); String[] firstRow = fileContent.get(0).split(";", -1); validateCsvFileStructure(firstRow, ExaminationStatistics2016Short.SHORT_FIELD_SET, ExaminationStatistics2016Short.SHORT_FIELD_LENGTHS); int rowCount = getRowCount(); assertEquals("database and unload file have the same row count", rowCount, fileContent.size()); // assert empty fields are empty for (String row : fileContent) { String[] columns = row.split(";", -1); String ef11 = columns[ExaminationStatistics2016Short.SHORT_FIELD_SET.indexOf("EF11")]; String ef21 = columns[ExaminationStatistics2016Short.SHORT_FIELD_SET.indexOf("EF21")]; String ef120 = columns[ExaminationStatistics2016Short.SHORT_FIELD_SET.indexOf("EF120")]; assertTrue("EF11 is null or empty", Strings.isNullOrEmpty(ef11)); assertTrue("EF21 is null or empty", Strings.isNullOrEmpty(ef21)); assertTrue("EF120 is null or empty", Strings.isNullOrEmpty(ef120)); } } /** * Method to check the structure of a csv row
* Validation:
*
    *
  1. document has 207 (98 when short data set) columns
  2. *
  3. document has no column names
  4. *
  5. last column contains 'berichtseinheitid'
  6. *
  7. columns have the specified length
  8. *
      * * @param row * @param fieldlength * @param fieldset * @throws SQLException */ @SuppressWarnings("static-method") private void validateCsvFileStructure(String[] row, List fieldSet, int[] fieldLength) throws SQLException { final int COLUMN_COUNT = fieldSet.size(); assertEquals("Document has correct column count", COLUMN_COUNT, row.length - 1); // 'row.length -1' because of // line.split(";", -1); assertTrue("Document has no column_names", row[0].matches("\\d+")); assertEquals("First column contains berichtseinheitid", "99910000", row[0]); String ASSERTION_TEMPLATE = "Column %s (index %d) has the desired length"; for (int i = 0; i < fieldSet.size(); i++) { String content = row[i]; if (!content.isEmpty()) { int desiredContentLength = fieldLength[i]; assertEquals(String.format(ASSERTION_TEMPLATE, fieldSet.get(i), Integer.valueOf(i)), desiredContentLength, content.length()); } } } /** * Method to test xml export of student statistics. * This test actually fails because the survey.properties has to be updated and -obviously- * each statistic need its own .properties-file * @throws Exception */ @Test @SuppressWarnings("static-method") public void testStudentStatistics2016XmlExport() throws Exception { String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/students"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.STUDENTS2016); statisticExport.setDataSource(dataSource); File exportXmlFile = new File(TMP_DIR, "junit_student_statistic_2016.xml"); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(exportXmlFile)); statisticExport.generate(outputStream); int dbRowCount = getRowCount(); Namespace namespace = Namespace.getNamespace("http://www.destatis.de/schema/datml-raw/2.0/de"); Element xmlRoot = XmlUtil.getRootElement(exportXmlFile); List saetze = XmlUtil.traverse(xmlRoot, namespace, "nachricht", "datensegment").getChildren("satz", namespace); assertEquals("XML and database have the same row count", dbRowCount, saetze.size()); } /** * Method to test xml export of examination statistics. * This test actually fails because the survey.properties has to be updated and -obviously- * each statistic need its own .properties-file * @throws Exception */ @Test @SuppressWarnings("static-method") public void testExaminationStatistics2016XmlExport() throws Exception { String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/examinations"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); StatisticExport statisticExport = testClassInstances.get(DistributionType.EXAMINATIONS2016); statisticExport.setDataSource(dataSource); File exportXmlFile = new File(TMP_DIR, "junit_examination_statistic_2016.xml"); OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(exportXmlFile)); statisticExport.generate(outputStream); int dbRowCount = getRowCount(); Namespace namespace = Namespace.getNamespace("http://www.destatis.de/schema/datml-raw/2.0/de"); Element xmlRoot = XmlUtil.getRootElement(exportXmlFile); List saetze = XmlUtil.traverse(xmlRoot, namespace, "nachricht", "datensegment").getChildren("satz", namespace); assertEquals("XML and database have the same row count", dbRowCount, saetze.size()); } private static int getRowCount() throws Exception { ResultSet resultSet = dataSource.getConnection().createStatement().executeQuery("SELECT count(*) FROM astat_astat"); resultSet.next(); return resultSet.getInt(1); } /** * Actual for developing purposes * * @throws Exception */ @Test @SuppressWarnings("static-method") public void testDoPlausiMussStudentsStatistics2016() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/students"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); // seems like postgres' SERIAL is not supported so change it to H2's auto_increment dataSource.getConnection().createStatement().execute("ALTER TABLE astat_plausi ALTER COLUMN tid SET GENERATED BY DEFAULT;"); StatisticExport statisticExport = testClassInstances.get(DistributionType.STUDENTS2016); statisticExport.setDataSource(dataSource); String iMussKategorieInMaske="2"; String iMussKategorie="1"; statisticExport.doPlausi(iMussKategorieInMaske); statisticExport.readPlausiFromDb(iMussKategorie, new FileOutputStream(new File(TMP_DIR, "junit_students_statistic_2016_plausi.csv"))); } /** * Actual for developing purposes * TC20844 aendert die Daten in k_field_of_study f. GuestPlausi-Fehler wie im junitTest * @throws Exception */ @Test @SuppressWarnings("static-method") public void testDoPlausiGuestStatistics2019() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/guest_statistics/schema"; String viewsPath = "test/resources/schema_files/guest_statistics/views"; String unloadsPath = "test/resources/schema_files/guest_statistics/unloads"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); // seems like postgres' SERIAL is not supported so change it to H2's auto_increment dataSource.getConnection().createStatement().execute("ALTER TABLE astat_plausi ALTER COLUMN tid SET GENERATED BY DEFAULT;"); StatisticExport statisticExport = testClassInstances.get(DistributionType.GUEST_LISTENERS2019); statisticExport.setDataSource(dataSource); String iMussKategorieInMaske="2"; String iMussKategorie="1"; statisticExport.doPlausi(iMussKategorieInMaske); statisticExport.readPlausiFromDb(iMussKategorie, new FileOutputStream(new File(TMP_DIR, "junit_guest_statistic_2019_plausi.csv"))); } /** * Actual for developing purposes * * @throws Exception */ @Test @SuppressWarnings("static-method") public void testDoPlausiKannStudentsStatistics2016() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/students"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); // seems like postgres' SERIAL is not supported so change it to H2's auto_increment dataSource.getConnection().createStatement().execute("ALTER TABLE astat_plausi ALTER COLUMN tid SET GENERATED BY DEFAULT;"); StatisticExport statisticExport = testClassInstances.get(DistributionType.STUDENTS2016); statisticExport.setDataSource(dataSource); String iKannMussKategorieInMaske="3"; String iKannKategorie="KANN"; statisticExport.doPlausi(iKannMussKategorieInMaske); statisticExport.readPlausiFromDb(iKannKategorie, new FileOutputStream(new File(TMP_DIR, "junit_students_statistic_2016_plausi.csv"))); } /** * Actual for developing purposes * * @throws Exception */ @Test @SuppressWarnings("static-method") public void testDoPlausiMussExaminationStatistics2016() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/students_and_examination_statistics/schema"; String viewsPath = "test/resources/schema_files/students_and_examination_statistics/views"; String unloadsPath = "test/resources/schema_files/students_and_examination_statistics/unloads/examinations"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); // seems like postgres' SERIAL is not supported so change it to H2's auto_increment dataSource.getConnection().createStatement().execute("ALTER TABLE astat_plausi ALTER COLUMN tid SET GENERATED BY DEFAULT;"); StatisticExport statisticExport = testClassInstances.get(DistributionType.EXAMINATIONS2016); statisticExport.setDataSource(dataSource); String iMussKategorieInMaske="2"; statisticExport.doPlausi(iMussKategorieInMaske); String iMussKategorie="1"; statisticExport.readPlausiFromDb(iMussKategorie, new FileOutputStream(new File(TMP_DIR, "junit_examination_statistic_2016_plausi.csv"))); } /** * Actual for developing purposes * * @throws Exception */ // @Ignore @Test @SuppressWarnings("static-method") public void testDoPlausiDoctoralCandidateStatistics() throws Exception { // create database and check row count String schemaPath = "test/resources/schema_files/doctoral_candidate_statistics/schema"; String viewsPath = "test/resources/schema_files/doctoral_candidate_statistics/views"; String unloadsPath = "test/resources/schema_files/doctoral_candidate_statistics/unloads"; createInMemoryDB(schemaPath, viewsPath, unloadsPath); // seems like postgres' SERIAL is not supported so change it to H2's auto_increment dataSource.getConnection().createStatement().execute("ALTER TABLE prom_stat_plausi ALTER COLUMN tid SET GENERATED BY DEFAULT;"); StatisticExport statisticExport = testClassInstances.get(DistributionType.DOCTORAL_CANDIDATE); statisticExport.setDataSource(dataSource); String dummy="0"; statisticExport.doPlausi(dummy); statisticExport.readPlausiFromDb(dummy, new FileOutputStream(new File(TMP_DIR, "junit_doctoral_candidate_statistic_plausi.csv"))); } private static void createInMemoryDB(String schemaPath, String viewsPath, String unloadsPath) throws Exception { H2InMemoryCreator h2InMemoryCreator = new H2InMemoryCreator(); h2InMemoryCreator.setSchemaDir(new File(schemaPath).getAbsolutePath()).setViewDir(new File(viewsPath).getAbsolutePath()).setUnlDir(new File(unloadsPath).getAbsolutePath()) .setUserName("sa").setTablePattern("(astat.*|sos.*|prom.*|hochschulinfo.*|cif.*)").setViewPattern("skipeverything").createH2InMemory(); dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.h2.Driver"); dataSource.setUsername("sa"); dataSource.setPassword(""); dataSource.setUrl(H2InMemoryCreator.JDBC_H2_IN_MEMORY_URL); dataSource.setMaxActive(10); dataSource.setMaxIdle(5); dataSource.setInitialSize(5); dataSource.setValidationQuery("SELECT 42"); } @Test @SuppressWarnings("static-method") public void testPlausibilityClassVersionExaminationAndStudents() throws Exception { String plausiVersionString = new Plausi_ERHEBUNG_STUDENTEN_PRUEFUNGEN_AB_2017().getPlausiVersionString(); assertEquals("Plausibility classes are up-to-date", EXAMINATION_AND_STUDENTS_PLAUSI_CLASSES_DATE, plausiVersionString); } @Test @SuppressWarnings("static-method") public void testPlausibilityClassVersionGuest() throws Exception { String plausiVersionString = new Plausi_ERHEBUNG_GASTHOERER_2019().getPlausiVersionString(); assertEquals("Plausibility classes are up-to-date", GUEST_PLAUSI_CLASSES_DATE, plausiVersionString); } @Test @SuppressWarnings("static-method") public void testPlausibilityClassVersionDoctoralCandidate() throws Exception { String plausiVersionString = new Plausi_ERHEBUNG_PROMOVIERENDE_AB_2017().getPlausiVersionString(); assertEquals("Plausibility classes are up-to-date", DOCTORAL_CANDIDATE_PLAUSI_CLASSES_DATE, plausiVersionString); } /** * General method tests */ @Test @SuppressWarnings("static-method") public void testExportFormat() { String contentType = StatisticExport.ExportFormat.XML.getContentType(); String mimeType = StatisticExport.ExportFormat.XML.getMimeType(); String extension = StatisticExport.ExportFormat.XML.getExtension(); assertEquals("ContentType as expected", contentType, "text/xml"); assertEquals("MimeType as expected", mimeType, "text/xml"); assertEquals("Extension as expected", extension, "xml"); assertEquals(ExportFormat.getForMimeType(mimeType), StatisticExport.ExportFormat.XML); contentType = StatisticExport.ExportFormat.CSV.getContentType(); mimeType = StatisticExport.ExportFormat.CSV.getMimeType(); extension = StatisticExport.ExportFormat.CSV.getExtension(); assertEquals("ContentType as expected", contentType, "text/comma-separated-values"); assertEquals("MimeType as expected", mimeType, "text/csv"); assertEquals("Extension as expected", extension, "csv"); assertEquals(ExportFormat.getForMimeType(mimeType), StatisticExport.ExportFormat.CSV); contentType = StatisticExport.ExportFormat.TXT.getContentType(); mimeType = StatisticExport.ExportFormat.TXT.getMimeType(); extension = StatisticExport.ExportFormat.TXT.getExtension(); assertEquals("ContentType as expected", contentType, "text/plain"); assertEquals("MimeType as expected", mimeType, "text/plain"); assertEquals("Extension as expected", extension, "txt"); assertEquals(ExportFormat.getForMimeType(mimeType), StatisticExport.ExportFormat.TXT); contentType = StatisticExport.ExportFormat.ZIP.getContentType(); mimeType = StatisticExport.ExportFormat.ZIP.getMimeType(); extension = StatisticExport.ExportFormat.ZIP.getExtension(); assertEquals("ContentType as expected", contentType, "application/zip"); assertEquals("MimeType as expected", mimeType, "application/zip"); assertEquals("Extension as expected", extension, "zip"); assertEquals(ExportFormat.getForMimeType(mimeType), StatisticExport.ExportFormat.ZIP); contentType = StatisticExport.ExportFormat.UNKNOWN.getContentType(); mimeType = StatisticExport.ExportFormat.UNKNOWN.getMimeType(); extension = StatisticExport.ExportFormat.UNKNOWN.getExtension(); assertEquals("ContentType as expected", contentType, ""); assertEquals("MimeType as expected", mimeType, ""); assertEquals("Extension as expected", extension, ""); assertEquals(ExportFormat.getForMimeType(mimeType), StatisticExport.ExportFormat.UNKNOWN); } @Test @SuppressWarnings("static-method") public void testConstructorWithWrongSqlParameter() { final String EXPECTED_SQL = "select berichtseinheitid, ef001 , ef002 , ef003 , ef004 , ef005 , ef006 , ef007 , ef008u1 , ef008u2 , ef008u3 , ef009 , ef010 , ef011 , ef012u1 , ef012u2 , " + "ef013u1 , ef013u2 , ef014 , ef015 , ef016 , ef017 , ef018 , ef019 , ef020 , ef021 , ef022 , ef023 , ef024 , ef025 , ef026 , ef027 , ef028 ," + " ef029 , ef030 , ef031 , ef032 , ef033 , ef034u1 , ef034u2 , ef035 , ef036 , ef037 , ef038 , ef039 , ef040 , ef041 , ef042 , ef043 , ef044 , " + "ef045 , ef046 , ef047 , ef048 , ef049 , ef050u1 , ef050u2 , ef051 , ef052 , ef053 , ef054 , ef055 , ef056 , ef057 , ef058 , ef059 , ef060 ," + " ef061 , ef062 , ef063 , ef064 , ef065 , ef066 , ef067 , ef068 , ef069 , ef070 , ef071 , ef072 , ef073 , ef074 , ef075 , ef076 , ef077 ," + " ef078 , ef079 , ef080 , ef081 , ef082 , ef083 , ef084 , ef085 , ef086 , ef087 , ef088 , ef089 , ef090 , ef091 , ef092 , ef093 , ef094 , " + "ef095 , ef096 , ef097 , ef098 , ef099 , ef100 , ef101 , ef102 , ef103 , ef104 , ef105 , ef106 , ef107 , ef108 , ef109 , ef110 , ef111 , " + "ef112 , ef113 , ef114 , ef115 , ef116 , ef117 , ef118 , ef119u1 , ef119u2 , ef120 , ef121 , ef122 , ef123 , ef124 , ef125 , ef126 , ef127 , " + "ef128 , ef129 , ef130 , ef131 , ef132 , ef133 , ef134 , ef135 , ef136 , ef137 , ef138 , ef139 , ef140 , ef141 , ef142 , ef143 , ef144 , " + "ef145 , ef146 , ef147 , ef148 , ef149 , ef150 , ef151 , ef152 , ef153 , ef154 , ef155 , ef156 , ef157 , ef158 , ef159 , ef160 , ef161 , " + "ef162 , ef163 , ef164 , ef165 , ef166 , ef167 , ef168 , ef169 , ef170 , ef171 , ef172 , ef173 , ef174 , ef175 , ef176 , ef177 , ef178 , " + "ef179 , ef180 , ef181 , ef182 , ef183 , ef184 , ef185 , ef186 , ef187 , ef188 , ef189 , ef190 , ef191 , ef192 , ef193 , ef194 , ef195 ," + " ef196 , ef197 , ef198 , ef199 from astat_astat order by ef006"; String configDir = new File("superx/WEB-INF/conf/edustore/db/module/sos/etl/statistik2016").getAbsolutePath(); String sqlFilterClause = null; StatisticExport statisticExport = new StatisticExport(DistributionType.STUDENTS2016, configDir, sqlFilterClause); assertEquals(EXPECTED_SQL.toLowerCase().replaceAll("\\s", ""), statisticExport.sql.toLowerCase().replaceAll("\\s", "")); } }