@SuppressWarnings("unchecked") @Test( groups = {"validation"}, description = "test") public void verifyValidation() throws ChouetteException { INeptuneManager<Line> lineManager; lineManager = (INeptuneManager<Line>) applicationContext.getBean("lineManager"); List<ParameterValue> values = new ArrayList<ParameterValue>(); SimpleParameterValue file = new SimpleParameterValue("inputFile"); file.setFilepathValue("src/test/data/test_neptune.zip"); values.add(file); SimpleParameterValue validate = new SimpleParameterValue("validate"); validate.setBooleanValue(Boolean.TRUE); values.add(validate); ReportHolder reportHolder = new ReportHolder(); List<Line> lines = lineManager.doImport(null, "NEPTUNE", values, reportHolder); Report importReport = reportHolder.getReport(); printItems("", importReport.getItems()); List<ParameterValue> parameters = new ArrayList<ParameterValue>(); SimpleParameterValue outputFile = new SimpleParameterValue("outputFile"); outputFile.setFilepathValue("target/test/gtfs.zip"); parameters.add(outputFile); SimpleParameterValue timeZone = new SimpleParameterValue("timeZone"); timeZone.setStringValue("Europe/Paris"); parameters.add(timeZone); ReportHolder exportReport = new ReportHolder(); lineManager.doExport(null, lines, "GTFS", parameters, exportReport); // printItems("",exportReport.getReport().getItems()); }
@Test( groups = {"CheckParameters"}, description = "Export Plugin should reject unknown parameter", dependsOnMethods = {"getBean"}, expectedExceptions = {IllegalArgumentException.class}) public void verifyCheckUnknownParameter() throws ChouetteException { List<ParameterValue> parameters = new ArrayList<ParameterValue>(); SimpleParameterValue simpleParameterValue = new SimpleParameterValue("outputFile"); simpleParameterValue.setFilepathValue(path + "/dummyFile.xml"); parameters.add(simpleParameterValue); simpleParameterValue = new SimpleParameterValue("dummyParameter"); simpleParameterValue.setStringValue("dummy value"); parameters.add(simpleParameterValue); ReportHolder report = new ReportHolder(); List<Line> lines = new ArrayList<Line>(); lines.add(new Line()); exportLine.doExport(lines, parameters, report); Assert.fail("expected exception not raised"); }