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

generatesFiles() reports incorrect message if file is present but content doesn't match #182

Open
ZacSweers opened this issue Jan 14, 2020 · 1 comment
Assignees
Labels
P3 type=defect Bug, not working as expected

Comments

@ZacSweers
Copy link
Contributor

If a matching file is found but the content just doesn't match, generatesFiles() will report that no matching file was found. While maybe technically correct if "matching" in this case includes the content, it's misleading in practice since the target file name was found and the content mismatch is the interesting bit.

@cgdecker cgdecker added P3 type=defect Bug, not working as expected labels Jan 21, 2020
@netdpb
Copy link
Member

netdpb commented May 24, 2021

Have you tried using the newer API? Instead of

assertThat(source1, source2).compilesWithoutWarnings().and().generatesFiles(expected1, expected2);

try

Compilation compilation = javac().compile(source1, source2);
assertThat(compilation).generatedFile(SOURCE_OUTPUT, "path/to/file").contentsAsUtfString().isEqualTo(expected);

(or one of the other APIs to check the contents of the files).

@netdpb netdpb self-assigned this May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

3 participants