Skip to content

Commit c6f962a

Browse files
javier-godoymlopezFC
authored andcommitted
test: throw exception if test resource is not found
1 parent ef03515 commit c6f962a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/java/com/flowingcode/vaadin/addons/demo/it/AbstractSourceCodeViewerIT.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import java.io.IOException;
2323
import java.io.InputStream;
24+
import java.util.MissingResourceException;
2425
import java.util.stream.Collectors;
2526
import java.util.stream.Stream;
2627
import org.apache.commons.io.IOUtils;
@@ -47,8 +48,12 @@ protected void open(String resource, String... args) {
4748
viewer = $(SourceCodeViewerElement.class).waitForFirst();
4849
}
4950

50-
private static String getExpectedText(String resource) {
51-
InputStream in = AbstractSourceCodeViewerIT.class.getResourceAsStream(resource + ".txt");
51+
private String getExpectedText(String resource) {
52+
resource += ".txt";
53+
InputStream in = this.getClass().getResourceAsStream(resource);
54+
if (in == null) {
55+
throw new MissingResourceException(resource, null, null);
56+
}
5257
try {
5358
return new String(IOUtils.toByteArray(in), "UTF-8").trim().replaceAll("\r", "");
5459
} catch (IOException e) {

0 commit comments

Comments
 (0)