Identified depracations and updated the code

This commit is contained in:
Glenn Renfro
2023-03-20 14:01:45 -04:00
parent afc1b2ea9e
commit 4f0b68bd0b
8 changed files with 41 additions and 62 deletions

View File

@@ -17,6 +17,7 @@
package io.spring;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.SQLException;
@@ -26,16 +27,16 @@ import java.util.Map;
import javax.sql.DataSource;
import org.assertj.core.api.Assertions;
import org.h2.tools.Server;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
//import org.springframework.batch.test.AssertFile;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.core.io.ClassPathResource;
//import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
@@ -145,9 +146,9 @@ public class BatchJobApplicationTests {
}
private void validateFileResult() throws Exception {
// AssertFile.assertLineCount(6, new FileSystemResource("./result.txt"));
// AssertFile.assertFileEquals(new ClassPathResource("testresult.txt"),
// new FileSystemResource(this.outputFile));
assertThat(Assertions.linesOf(this.outputFile, StandardCharsets.UTF_16).size()).isEqualTo(6);
assertThat(Assertions.contentOf((new ClassPathResource("testresult.txt")).getFile())
.equals(new FileSystemResource(this.outputFile)));
}
private void validateDBResult() {