public static void assertFileEquals(Resource expected, Resource actual) throws Exception { assertFileEquals(expected.getFile(), actual.getFile()); }
public static void assertLineCount(int expectedLineCount, Resource resource) throws Exception { assertLineCount(expectedLineCount, resource.getFile()); } }
private void executeAssertEquals(String expected, String actual) throws Exception { AssertFile.assertFileEquals(new FileSystemResource(DIRECTORY + expected), new FileSystemResource(DIRECTORY + actual)); }
@Test public void testAssertLineCount() throws Exception { AssertFile.assertLineCount(5, new FileSystemResource(DIRECTORY + "input1.txt")); } }
/** * Output should be the same as input */ @Test public void testJob() throws Exception { jobLauncherTestUtils.launchJob(); AssertFile.assertFileEquals(new FileSystemResource(INPUT_FILE), new FileSystemResource(OUTPUT_FILE)); } }
@Test public void runTest() throws Exception { JobParameters jobParameters = jobLauncherTestUtils.getUniqueJobParameters(); JobExecution je1 = jobLauncherTestUtils.launchJob(jobParameters); assertEquals(BatchStatus.FAILED, je1.getStatus()); AssertFile.assertLineCount(10, outputResource); JobExecution je2 = jobLauncherTestUtils.launchJob(jobParameters); assertEquals(BatchStatus.COMPLETED, je2.getStatus()); AssertFile.assertLineCount(20, outputResource); }
@Test public void testJobLaunch() throws Exception { jobLauncherTestUtils.launchJob(); assertFileEquals(new ClassPathResource(EXPECTED), new FileSystemResource(ACTUAL)); }
/** * Output should be the same as input */ @Test public void testJob() throws Exception { jobLauncherTestUtils.launchJob(); AssertFile.assertFileEquals(new FileSystemResource(INPUT_FILE), new FileSystemResource(OUTPUT_FILE)); } }
public static void assertFileEquals(Resource expected, Resource actual) throws Exception { AssertFile.assertFileEquals(expected.getFile(), actual.getFile()); } }
@Test public void testValidRun() { try { JobExecution jobExecution = this.launchStep("step1"); //Ensure job completed successfully. Assert.isTrue(jobExecution.getExitStatus().equals(ExitStatus.COMPLETED), "Step Execution did not complete normally: " + jobExecution.getExitStatus()); //Check output. Assert.isTrue(actual.exists(), "Actual does not exist."); AssertFile.assertFileEquals(expected.getFile(), actual.getFile()); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }
@Test public void testValidRun() { try { JobExecution jobExecution = this.launchStep("step1"); //Ensure job completed successfully. Assert.isTrue(jobExecution.getExitStatus().equals(ExitStatus.COMPLETED), "Step Execution did not complete normally: " + jobExecution.getExitStatus()); //Check output. Assert.isTrue(actual.exists(), "Actual does not exist."); AssertFile.assertFileEquals(expected.getFile(), actual.getFile()); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }