-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create parameter resolver for class path resources #503
Comments
One possible approach is shown in this reply to the tweet: @Test
@ResourceRead("sub/anton.txt")
void asContentLines(ResourceContentLines resource) {
resource.getContent();
}
@Test
@ResourceRead("sub/anton.txt")
void asContentString(ResourceContentString resource) {
resource.getContent();
} Another approach would be to always annotate the parameter (I'll keep using @Test
void asContentString(@ResourceRead("sub/anton.txt") String content) {
// ...
} Since we then know which parameter to provide a value for (and thus its type), we can resolve a wide variety of types:
As to the annotation itself, it should probably offer the same attributes that the |
JUnit does not register extensions from parameter annotations. Meaning this:
does not work. |
Ah right, I seem to forget this quite often... 🤦🏾 See linked issue ☝🏾 - maybe that can change. |
As a side note, we might want to name the annotation But perhaps that indicates that I need to improve the name of my work's own "resource" thingie instead! |
Would really like to see this, to easily have the possibility to offer XML-Strings. |
Shall we ask him to integrate it into pioneer? |
Hi @khmarbaise, we'd like to have something like this in Pioneer. Would you be interested to integrate your project here (i.e. republish an adapted version of the code in this project)? :) |
Hi @nipafx sure sure why not ... |
An extension that makes it easy to read resources from
src/test/resources
as discussed in this tweet.The text was updated successfully, but these errors were encountered: