1 | |
package org.jbehave.core.io.odf; |
2 | |
|
3 | |
import org.jbehave.core.io.InvalidStoryResource; |
4 | |
import org.jbehave.core.io.LoadFromClasspath; |
5 | |
|
6 | |
import static org.jbehave.core.io.odf.OdfUtils.loadOdt; |
7 | |
import static org.jbehave.core.io.odf.OdfUtils.parseOdt; |
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
public class LoadOdtFromClasspath extends LoadFromClasspath { |
13 | |
|
14 | |
public LoadOdtFromClasspath(Class<?> loadFromClass) { |
15 | 2 | this(loadFromClass.getClassLoader()); |
16 | 2 | } |
17 | |
|
18 | |
public LoadOdtFromClasspath(ClassLoader classLoader) { |
19 | 2 | super(classLoader); |
20 | 2 | } |
21 | |
|
22 | |
@Override |
23 | |
public String loadResourceAsText(String storyPath) { |
24 | |
try { |
25 | 2 | return parseOdt(loadOdt(resourceAsStream(storyPath))); |
26 | 1 | } catch (Exception cause) { |
27 | 1 | throw new InvalidStoryResource(storyPath, cause); |
28 | |
} |
29 | |
} |
30 | |
|
31 | |
} |