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