This commit is contained in:
amit2103 2019-06-29 21:34:55 +05:30
parent 783a93fb47
commit ce8f3f54c5

View File

@ -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");
}
} }