Merge pull request #7214 from amit2103/BAEL-14274-18

[BAEL-14274] - Fixed article code for https://www.baeldung.com/spring…
This commit is contained in:
Loredana Crusoveanu
2019-07-20 21:34:11 +03:00
committed by GitHub

View File

@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -77,7 +78,7 @@ public class SpringResourceIntegrationTest {
@Test
public void whenResourceUtils_thenReadSuccessful() throws IOException {
final File employeeFile = ResourceUtils.getFile("classpath:data/employees.dat");
final File employeeFile = loadEmployeesWithSpringInternalClass();
final String employees = new String(Files.readAllBytes(employeeFile.toPath()));
assertEquals(EMPLOYEES_EXPECTED, employees);
}
@@ -112,4 +113,8 @@ public class SpringResourceIntegrationTest {
final String employees = new String(Files.readAllBytes(resource.toPath()));
assertEquals(EMPLOYEES_EXPECTED, employees);
}
public File loadEmployeesWithSpringInternalClass() throws FileNotFoundException {
return ResourceUtils.getFile("classpath:data/employees.dat");
}
}