-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36c24be
commit 7d9d01c
Showing
3 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tester/src/main/java/io/github/android/tang/tony/test/util/TestResourcesRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.android.tang.tony.test.util; | ||
|
||
import java.io.InputStream; | ||
import org.junit.rules.ExternalResource; | ||
|
||
public class TestResourcesRule extends ExternalResource { | ||
|
||
String resourceFilePath; | ||
|
||
public TestResourcesRule(String resourceFilePath) { | ||
this.resourceFilePath = resourceFilePath; | ||
} | ||
|
||
public String content() { | ||
return content("utf-8"); | ||
} | ||
|
||
public String content(String charSet) { | ||
return TestUtil.content(resourceFilePath, charSet, this); | ||
} | ||
|
||
public InputStream inputStream() { | ||
return getClass().getResourceAsStream(resourceFilePath); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters