Skip to content
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

Unable to create resource content in code. #52

Open
JakeWharton opened this issue Aug 2, 2014 · 0 comments
Open

Unable to create resource content in code. #52

JakeWharton opened this issue Aug 2, 2014 · 0 comments
Labels
P3 type=enhancement Make an existing feature better

Comments

@JakeWharton
Copy link
Contributor

StringSourceJavaFileObject (via forSourceString) assumes I'm creating a SOURCE object when I want to create an OTHER (resource file).

In @AutoService you use actual resources as the expected generated content. I prefer to keep both the originating source and generated sources in the actual test so everything is in one place.

String source = ""
    + "package com.example;\n"
    + "\n"
    + "import com.example.auto.resource.thingy.AutoResourceThingy;\n"
    + "\n"
    + "@AutoResourceThingy\n"
    + "public class Example {}";
JavaFileObject sourceFile = JavaFileObjects.forSourceString("com.example.Example", source);

JavaFileObject expectedSource =
    JavaFileObjects.forSourceString("META-INF/thingy/com.example.Example",
        "THINGY!");

ASSERT.about(javaSource()).that(sourceFile)
    .processedWith(autoResourceThingy())
    .compilesWithoutError()
    .and()
    .generatesFiles(expectedSource);
@raghsriniv raghsriniv added the P3 label Jun 26, 2019
@cgdecker cgdecker added the type=enhancement Make an existing feature better label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=enhancement Make an existing feature better
Projects
None yet
Development

No branches or pull requests

3 participants